[llvm] r367801 - [DWARF] Change DWARFDebugLoc::Entry::Loc from SmallVector<char, 4> to SmallString<4>

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 23:33:52 PDT 2019


Author: maskray
Date: Sun Aug  4 23:33:52 2019
New Revision: 367801

URL: http://llvm.org/viewvc/llvm-project?rev=367801&view=rev
Log:
[DWARF] Change DWARFDebugLoc::Entry::Loc from SmallVector<char, 4> to SmallString<4>

SmallString has a conversion to StringRef, which can be leveraged to
simplify two use sites.

Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h?rev=367801&r1=367800&r2=367801&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h Sun Aug  4 23:33:52 2019
@@ -29,7 +29,7 @@ public:
     /// The ending address of the instruction range.
     uint64_t End;
     /// The location of the variable within the specified range.
-    SmallVector<char, 4> Loc;
+    SmallString<4> Loc;
   };
 
   /// A list of locations that contain one variable.

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=367801&r1=367800&r2=367801&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Sun Aug  4 23:33:52 2019
@@ -485,7 +485,7 @@ unsigned DWARFVerifier::verifyDebugInfoA
       if (auto DebugLoc = DCtx.getDebugLoc())
         if (auto LocList = DebugLoc->getLocationListAtOffset(*LocOffset))
           for (const auto &Entry : LocList->Entries)
-            VerifyLocationExpr({Entry.Loc.data(), Entry.Loc.size()});
+            VerifyLocationExpr(Entry.Loc);
     }
     break;
   }
@@ -1297,7 +1297,7 @@ static bool isVariableIndexable(const DW
       if (const DWARFDebugLoc::LocationList *LocList =
               DebugLoc->getLocationListAtOffset(*Offset)) {
         if (any_of(LocList->Entries, [&](const DWARFDebugLoc::Entry &E) {
-              return ContainsInterestingOperators({E.Loc.data(), E.Loc.size()});
+              return ContainsInterestingOperators(E.Loc);
             }))
           return true;
       }




More information about the llvm-commits mailing list