[all-commits] [llvm/llvm-project] c95098: [CIR] Add CIRGen support for static local variable...

Bruno Cardoso Lopes via All-commits all-commits at lists.llvm.org
Thu Feb 12 19:20:12 PST 2026


  Branch: refs/heads/users/bcardosolopes/cir-static-local-cirgen
  Home:   https://github.com/llvm/llvm-project
  Commit: c9509827e8cde0afe8181ba382bd59eb99f38a96
      https://github.com/llvm/llvm-project/commit/c9509827e8cde0afe8181ba382bd59eb99f38a96
  Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
  Date:   2026-02-13 (Fri, 13 Feb 2026)

  Changed paths:
    M clang/include/clang/CIR/Dialect/IR/CIRAttrs.h
    M clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
    M clang/include/clang/CIR/Dialect/IR/CIROps.td
    M clang/lib/CIR/CodeGen/CIRGenCXX.cpp
    M clang/lib/CIR/CodeGen/CIRGenDecl.cpp
    M clang/lib/CIR/CodeGen/CIRGenDeclCXX.cpp
    M clang/lib/CIR/CodeGen/CIRGenFunction.h
    M clang/lib/CIR/CodeGen/CIRGenModule.cpp
    M clang/lib/CIR/Dialect/IR/CIRDialect.cpp
    M clang/lib/CIR/Dialect/Transforms/LoweringPrepare.cpp
    M clang/test/CIR/CodeGen/global-array-dtor.cpp
    M clang/test/CIR/CodeGen/global-init.cpp
    A clang/test/CIR/CodeGen/static-local.cpp

  Log Message:
  -----------
  [CIR] Add CIRGen support for static local variables with non-constant initializers

This adds CIRGen infrastructure for C++ function-local static variables
that require guarded initialization (Itanium C++ ABI).

Changes:
- Add ASTVarDeclAttr to carry VarDecl AST through the pipeline
- Add emitGuardedInit() to CIRGenCXXABI for guarded initialization
- Add emitCXXGuardedInit() to CIRGenFunction
- Replace NYI in addInitializerToStaticVarDecl() with ctor region emission
- Set static_local attribute on GlobalOp and GetGlobalOp

The global's ctor region contains the initialization code, which will be
lowered by LoweringPrepare to emit the actual guard variable pattern with
__cxa_guard_acquire/__cxa_guard_release calls.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list