mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 20:51:35 +00:00
[OpenCL] Fix address space for const method call from nonconst (PR43145)
Patch by Anastasia Stulova and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D68781
This commit is contained in:
parent
22f9429149
commit
82888b78d4
@ -5370,7 +5370,10 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
|
||||
|
||||
if (!Context.hasSameType(From->getType(), DestType)) {
|
||||
CastKind CK;
|
||||
if (FromRecordType.getAddressSpace() != DestType.getAddressSpace())
|
||||
QualType PteeTy = DestType->getPointeeType();
|
||||
LangAS DestAS =
|
||||
PteeTy.isNull() ? DestType.getAddressSpace() : PteeTy.getAddressSpace();
|
||||
if (FromRecordType.getAddressSpace() != DestAS)
|
||||
CK = CK_AddressSpaceConversion;
|
||||
else
|
||||
CK = CK_NoOp;
|
||||
|
@ -203,3 +203,14 @@ TEST(__private)
|
||||
// IMPL: [[C2GENVOID:%[0-9]+]] = bitcast %class.C addrspace(4)* [[C2GEN]] to i8 addrspace(4)*
|
||||
// IMPL: [[C1GENVOID:%[0-9]+]] = bitcast %class.C addrspace(4)* [[C1GEN]] to i8 addrspace(4)*
|
||||
// IMPL: call void @llvm.memcpy.p4i8.p4i8.i32(i8 addrspace(4)* {{.*}}[[C2GENVOID]], i8 addrspace(4)* {{.*}}[[C1GENVOID]]
|
||||
|
||||
// Test that calling a const method from a non-const method does not crash Clang.
|
||||
class ConstAndNonConstMethod {
|
||||
public:
|
||||
void DoConst() const {
|
||||
}
|
||||
|
||||
void DoNonConst() {
|
||||
DoConst();
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user