[clang] [CIR] Upstream support for string literals (PR #140796)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Wed May 21 03:22:29 PDT 2025


================
@@ -136,6 +139,14 @@ class CIRGenModule : public CIRGenTypeCache {
   getAddrOfGlobalVar(const VarDecl *d, mlir::Type ty = {},
                      ForDefinition_t isForDefinition = NotForDefinition);
 
+  /// Return a constant array for the given string.
+  mlir::Attribute getConstantArrayFromStringLiteral(const StringLiteral *e);
+
+  /// Return a global symbol reference to a constant array for the given string
+  /// literal.
+  cir::GlobalOp getGlobalForStringLiteral(const StringLiteral *S,
+                                          llvm::StringRef Name = ".str");
----------------
xlauko wrote:

```suggestion
  cir::GlobalOp getGlobalForStringLiteral(const StringLiteral *s,
                                          llvm::StringRef name = ".str");
```

https://github.com/llvm/llvm-project/pull/140796


More information about the cfe-commits mailing list