Skip to content

Commit 0b4a042

Browse files
committed
Fix subexpr as extraction by getting pointee type.
1 parent 30c7d9a commit 0b4a042

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,11 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
18891889
cgf.getLoc(subExpr->getExprLoc()));
18901890
}
18911891

1892-
clang::LangAS srcLangAS = subExpr->getType().getAddressSpace();
1892+
clang::QualType srcTy = subExpr->IgnoreImpCasts()->getType();
1893+
if (srcTy->isPointerType() || srcTy->isReferenceType())
1894+
srcTy = srcTy->getPointeeType();
1895+
1896+
clang::LangAS srcLangAS = srcTy.getAddressSpace();
18931897
cir::TargetAddressSpaceAttr subExprAS;
18941898
if (clang::isTargetAddressSpace(srcLangAS))
18951899
subExprAS = cir::toCIRTargetAddressSpace(cgf.getMLIRContext(), srcLangAS);

0 commit comments

Comments
 (0)