[llvm] 3f3680d - DWARFVerifier: Simplify name lookups

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 19 12:33:09 PST 2021


Author: David Blaikie
Date: 2021-11-19T12:31:27-08:00
New Revision: 3f3680dff3e72881bd89241fe512ec8138edbc70

URL: https://github.com/llvm/llvm-project/commit/3f3680dff3e72881bd89241fe512ec8138edbc70
DIFF: https://github.com/llvm/llvm-project/commit/3f3680dff3e72881bd89241fe512ec8138edbc70.diff

LOG: DWARFVerifier: Simplify name lookups

No need to use the dynamic fallback query when the name type is known
statically at the call site.

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index dcabefb9896ed..fb0798f204e1e 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -1289,16 +1289,14 @@ DWARFVerifier::verifyNameIndexAbbrevs(const DWARFDebugNames::NameIndex &NI) {
 static SmallVector<StringRef, 2> getNames(const DWARFDie &DIE,
                                           bool IncludeLinkageName = true) {
   SmallVector<StringRef, 2> Result;
-  if (const char *Str = DIE.getName(DINameKind::ShortName))
+  if (const char *Str = DIE.getShortName())
     Result.emplace_back(Str);
   else if (DIE.getTag() == dwarf::DW_TAG_namespace)
     Result.emplace_back("(anonymous namespace)");
 
   if (IncludeLinkageName) {
-    if (const char *Str = DIE.getName(DINameKind::LinkageName)) {
-      if (Result.empty() || Result[0] != Str)
-        Result.emplace_back(Str);
-    }
+    if (const char *Str = DIE.getLinkageName())
+      Result.emplace_back(Str);
   }
 
   return Result;


        


More information about the llvm-commits mailing list