[llvm] [DebugInfo] Add Verifier check for local enums in CU's enums field (PR #185228)
Shivam Kunwar via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 8 21:13:30 PDT 2026
================
@@ -1574,6 +1574,10 @@ void Verifier::visitDICompileUnit(const DICompileUnit &N) {
auto *Enum = dyn_cast_or_null<DICompositeType>(Op);
CheckDI(Enum && Enum->getTag() == dwarf::DW_TAG_enumeration_type,
"invalid enum type", &N, N.getEnumTypes(), Op);
+ if (Enum->getScope())
+ CheckDI(!isa<DILocalScope>(Enum->getScope()),
+ "function-local enum in a DICompileUnit's enum list", &N,
+ N.getEnumTypes(), Op);
}
----------------
phyBrackets wrote:
might be worth combining into the existing CheckDI block rather than adding a separate if
```
CheckDI(!Enum->getScope() || !isa<DILocalScope>(Enum->getScope()),
"function-local enum in a DICompileUnit's enum list", &N,
N.getEnumTypes(), Op);
```
https://github.com/llvm/llvm-project/pull/185228
More information about the llvm-commits
mailing list