[llvm-branch-commits] [clang] [CIR] Add support for string literal lavlues in ConstantLValueEmitter (PR #154360)
Andy Kaylor via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 19 09:45:26 PDT 2025
================
@@ -1318,6 +1318,19 @@ cir::GlobalOp CIRGenModule::getGlobalForStringLiteral(const StringLiteral *s,
return gv;
}
+/// Return a pointer to a constant array for the given string literal.
+cir::GlobalViewAttr
+CIRGenModule::getAddrOfConstantStringFromLiteral(const StringLiteral *s,
+ StringRef name) {
+ cir::GlobalOp gv = getGlobalForStringLiteral(s, name);
+ auto arrayTy = mlir::dyn_cast<cir::ArrayType>(gv.getSymType());
+ assert(arrayTy && "String literal must be array");
----------------
andykaylor wrote:
```suggestion
auto arrayTy = mlir::cast<cir::ArrayType>(gv.getSymType());
```
https://github.com/llvm/llvm-project/pull/154360
More information about the llvm-branch-commits
mailing list