[flang-commits] [clang] [compiler-rt] [flang] [llvm] [mlir] [DebugMetadata][DwarfDebug][CodeView] Support function-local static variables in lexical block scopes (6/7) (PR #187927)

Vladislav Dzhidzhoev via flang-commits flang-commits at lists.llvm.org
Fri Jul 3 12:35:57 PDT 2026


================
@@ -2124,6 +2124,10 @@ class DICompileUnit : public DIScope {
   }
 
 public:
+  constexpr static unsigned GLOBALS_IDX = 6;
----------------
dzhidzhoev wrote:

> Given that operand numbers are still hardcoded explicitly in other places, I'd prefer to leave these three as they were.

Hmm, I think it goes back to the time when there were no DINode (and children) classes, and all metadata were stored in plain MDNodes. Not sure if this convention should be followed by new code.

> I'd rather not do this, it looks misleading to me. It's not clear what the purpose of these globals is or which metadata kind they belong to.

These constants are defined inside DICompileUnit class, and are used in getter and setters right there. For me it's rather clear, hm.
Anyway, I don't mind conventional approach.

https://github.com/llvm/llvm-project/pull/187927


More information about the flang-commits mailing list