[clang] [CIR] Materialize AST-derived facts as CIR attributes (PR #215921)
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 13 16:48:47 PDT 2026
================
@@ -1935,6 +1935,52 @@ def CIR_ASTVarDeclAttr : CIR_AST<"VarDecl", "var.decl", [
ASTVarDeclInterface
]>;
+//===----------------------------------------------------------------------===//
+// StaticLocalInfoAttr
+//===----------------------------------------------------------------------===//
+
+def CIR_StaticLocalInfoAttr
+ : CIR_Attr<"StaticLocalInfo", "static_local_info",
+ [ASTVarDeclInterface]> {
+ let summary = "AST-free cache of static-local VarDecl facts.";
+ let description = [{
+ Materialized form of the facts `cir::ASTVarDeclInterface` exposes, so
+ that post-CIRGen passes (notably LoweringPrepare) can query them without
+ a live `clang::ASTContext`. Emitted by CIRGen for static-local guarded
+ globals in place of the AST-backed `ASTVarDeclAttr`.
+
+ The TLS and template-specialization kinds are encoded as plain integers
+ matching the underlying `clang::VarDecl::TLSKind` and
+ `clang::TemplateSpecializationKind` enumerators.
+ }];
+
+ let parameters = (ins
+ "bool":$is_local_var_decl,
----------------
bcardosolopes wrote:
If this isn't dependend on the AST anymore it needs to roundtrip parser/printer, which needs tests.
https://github.com/llvm/llvm-project/pull/215921
More information about the cfe-commits
mailing list