diff options
author | David Blaikie <dblaikie@gmail.com> | 2019-06-14 01:58:56 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2019-06-14 01:58:56 +0000 |
commit | 4129e3e0f8e9acbb02dfd3082ad874e7d2d11b00 (patch) | |
tree | 34e2b8e8e3e77cc892837e7aa944d85c89d3de34 /llvm/lib/CodeGen | |
parent | 4121bdc3d49ae95654b5706a978fbd12e4e521dd (diff) | |
download | bcm5719-llvm-4129e3e0f8e9acbb02dfd3082ad874e7d2d11b00.tar.gz bcm5719-llvm-4129e3e0f8e9acbb02dfd3082ad874e7d2d11b00.zip |
DebugInfo: Include enumerators in pubnames
This is consistent with GCC's behavior (which is the defacto standard
for pubnames). Though I find the presence of enumerators from enum
classes to be a bit confusing, possibly a bug on GCC's end (since they
can't be named unqualified, unlike the other names - and names nested in
classes don't go in pubnames, for instance - presumably because one must
name the class first & that's enough to limit the scope of the search)
llvm-svn: 363349
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index b89162cdab0..991ab94b50a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1393,6 +1393,9 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) { addFlag(Buffer, dwarf::DW_AT_enum_class); } + auto *Context = CTy->getScope(); + bool IndexEnumerators = !Context || isa<DICompileUnit>(Context) || isa<DIFile>(Context) || + isa<DINamespace>(Context) || isa<DICommonBlock>(Context); DINodeArray Elements = CTy->getElements(); // Add enumerators to enumeration type. @@ -1404,6 +1407,8 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) { addString(Enumerator, dwarf::DW_AT_name, Name); auto Value = static_cast<uint64_t>(Enum->getValue()); addConstantValue(Enumerator, IsUnsigned, Value); + if (IndexEnumerators) + addGlobalName(Name, Enumerator, Context); } } } |