File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1515
1616#include " clang/AST/Expr.h"
1717#include " clang/AST/StmtVisitor.h"
18+ #include " clang/AST/TypeBase.h"
1819#include " clang/CIR/Dialect/IR/CIRTypes.h"
1920#include " clang/CIR/MissingFeatures.h"
21+ #include " llvm/Support/raw_ostream.h"
2022
2123#include " mlir/IR/Location.h"
2224#include " mlir/IR/Value.h"
@@ -1889,7 +1891,11 @@ mlir::Value ScalarExprEmitter::VisitCastExpr(CastExpr *ce) {
18891891 cgf.getLoc (subExpr->getExprLoc ()));
18901892 }
18911893
1892- clang::LangAS srcLangAS = subExpr->getType ().getAddressSpace ();
1894+ clang::QualType srcTy = subExpr->IgnoreImpCasts ()->getType ();
1895+ if (srcTy->isPointerType () || srcTy->isReferenceType ())
1896+ srcTy = srcTy->getPointeeType ();
1897+
1898+ clang::LangAS srcLangAS = srcTy.getAddressSpace ();
18931899 cir::TargetAddressSpaceAttr subExprAS;
18941900 if (clang::isTargetAddressSpace (srcLangAS))
18951901 subExprAS = cir::toCIRTargetAddressSpace (cgf.getMLIRContext (), srcLangAS);
You can’t perform that action at this time.
0 commit comments