Clang was creating an UncheckedDerivedToBase ImplicitCastExpr that was
also casting between address spaces. Insert an ImplicitCastExpr node
for doing the address space conversion.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/CodeGen/CGCall.cpp | ||
---|---|---|
4091 ↗ | (On Diff #227733) | @Anastasia pointed out that the AST might not be correct to begin with, which could cause us to fail here. | `-MemberExpr 0x5555558af2c0 <col:3, col:5> '<bound member function type>' .getRef 0x5555558a4008 | `-ImplicitCastExpr 0x5555558af310 <col:3> '__generic B2' lvalue <UncheckedDerivedToBase (B2)> | `-DeclRefExpr 0x5555558af2a0 <col:3> 'Derived' lvalue Var 0x5555558ab290 'd' 'Derived' The question is whether it's fine for the UncheckedDerivedToBase ImplicitCastExpr to cast from private to __generic; or do we need another AddrSpaceConversion ImplicitCastExpr node perhaps? |
clang/lib/CodeGen/CGCall.cpp | ||
---|---|---|
4091 ↗ | (On Diff #227733) | I agree that the AST should include an address-space conversion, not just a derived-to-base conversion. |
Comment Actions
Rework fix to insert an addrspace conversion node into the AST instead of catching the addrspace cast in CGCall.
clang/lib/Sema/SemaExpr.cpp | ||
---|---|---|
2721 | Both the source and dest types here are off by a level if we're working with a pointer; you need to do: auto FromRecordTypeWithoutAS = Context.removeAddrSpaceQualType(FromRecordType); auto FromTypeWithDestAS = Context.getAddrSpaceQualType(FromRecordTypeWithoutAS, DestAS); if (PointerConversions) FromTypeWithDestAS = Context.getPointerType(FromTypeWithDestAS); |
Both the source and dest types here are off by a level if we're working with a pointer; you need to do: