Skip to content

Commit e122423

Browse files
[SYCL] Fix incorrect return of PropertyValue::data() (#18944)
The data function of PropertyValue was returning a pointer to a pointer when the underlying data was a byte array, rather than returning the byte array pointer itself. This commit fixes the return value for the byte array case. --------- Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent 4b3ed9b commit e122423

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

llvm/include/llvm/Support/PropertySetIO.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,16 @@ class PropertyValue {
158158
}
159159
}
160160

161-
const char *data() const { return reinterpret_cast<const char *>(&Val); }
161+
const char *data() const {
162+
switch (Ty) {
163+
case UINT32:
164+
return reinterpret_cast<const char *>(&Val.UInt32Val);
165+
case BYTE_ARRAY:
166+
return reinterpret_cast<const char *>(Val.ByteArrayVal);
167+
default:
168+
llvm_unreachable_internal("unsupported property type");
169+
}
170+
}
162171

163172
private:
164173
template <typename T> T &getValueRef();

0 commit comments

Comments
 (0)