[PATCH] Turn local DWARFContext helpers getFileNameForUnit() and getFileLineInfoForCompileUnit() into full-blowm DWARFDebugLine::LineTable methods.

Alexey Samsonov vonosmas at gmail.com
Mon Sep 15 10:54:05 PDT 2014


Can you pass just a compilation dir instead of DWARFUnit* into a DWARFDebugLine methods? For now we don't need any other information from unit, and I'm not sure we will - line table should be more or less self-contained.

================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:663
@@ -658,3 +662,3 @@
   }
   SmallString<16> FilePath;
   uint64_t IncludeDirIndex = Entry.DirIdx;
----------------
Looks like you can have a single SmallString<> to construct an absolute filepath.

================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:693
@@ +692,3 @@
+                                                         DILineInfo &Result) const {
+  if (!CU)
+    return false;
----------------
It's not clear now why CU must be nonzero, even though getFileNameByIndex allows U to be nullptr.

================
Comment at: lib/DebugInfo/DWARFDebugLine.h:184
@@ -181,3 +183,3 @@
     // Returns true on success.
     bool getFileNameByIndex(uint64_t FileIndex,
                             DILineInfoSpecifier::FileLineInfoKind Kind,
----------------
It's somewhat confusing to have output parameter not the last parameter in the function. See my suggestion about passing compilation dir instead of DWARFUnit* - in this case you can just pass empty string if unit is unavailable.

http://reviews.llvm.org/D5354






More information about the llvm-commits mailing list