[all-commits] [llvm/llvm-project] b574c8: [CIR] Defer declarations and tentative definitions...

Andy Kaylor via All-commits all-commits at lists.llvm.org
Wed May 28 13:53:52 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b574c811e83a2f638714153cb2f915c625ac945c
      https://github.com/llvm/llvm-project/commit/b574c811e83a2f638714153cb2f915c625ac945c
  Author: Andy Kaylor <akaylor at nvidia.com>
  Date:   2025-05-28 (Wed, 28 May 2025)

  Changed paths:
    M clang/include/clang/CIR/CIRGenerator.h
    M clang/include/clang/CIR/MissingFeatures.h
    M clang/lib/CIR/CodeGen/CIRGenModule.cpp
    M clang/lib/CIR/CodeGen/CIRGenModule.h
    M clang/lib/CIR/CodeGen/CIRGenerator.cpp
    M clang/lib/CIR/FrontendAction/CIRGenAction.cpp
    M clang/test/CIR/CodeGen/array.cpp
    M clang/test/CIR/CodeGen/basic.c
    M clang/test/CIR/CodeGen/basic.cpp
    M clang/test/CIR/CodeGen/string-literals.c
    M clang/test/CIR/CodeGen/struct.c
    M clang/test/CIR/Lowering/array.cpp
    M clang/test/CIR/Lowering/hello.c

  Log Message:
  -----------
  [CIR] Defer declarations and tentative definitions (#141700)

This change adds code to defer emitting declarations and tentative
definitions until they are referenced or trigger by a call to
CompleteTentativeDefinition. This is needed to avoid premature handling
of declarations and definitions that might not be referenced in the
current translation unit. It also avoids incorrectly adding an
initializer to external declarations.

This change also updates the way the insertion location for globals is
chosen so that all globals will be emitted together at the top of the
module. This makes no functional difference, but it is very useful for
writing sensible tests.

Some tests are modified in this change to reorder global variables so
that they can be checked in the order in which they will be emitted.



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