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

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


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b5c41b4bdef7faaaf49125b41fdee0116824e73a
      https://github.com/llvm/llvm-project/commit/b5c41b4bdef7faaaf49125b41fdee0116824e73a
  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 (#179827)

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

This doesn't unwrap the high level constructs just yet - 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