[clang] [CIR] Upstream support for string literals (PR #140796)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue May 20 13:59:03 PDT 2025
================
@@ -26,6 +26,34 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc)
: CIRBaseBuilderTy(mlirContext), typeCache(tc) {}
+ /// Get a cir::ConstArrayAttr for a string literal.
+ /// Note: This is different from what is returned by
+ /// mlir::Builder::getStringAttr() which is an mlir::StringAttr.
+ mlir::Attribute getString(llvm::StringRef str, mlir::Type eltTy,
+ unsigned size) {
+ unsigned finalSize = size ? size : str.size();
----------------
erichkeane wrote:
instead of 0 being special, can we make `size` be an `optional`?
https://github.com/llvm/llvm-project/pull/140796
More information about the cfe-commits
mailing list