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

Alexey Samsonov vonosmas at gmail.com
Wed Sep 17 14:47:58 PDT 2014


================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:11
@@ -10,1 +10,3 @@
 #include "DWARFDebugLine.h"
+#include "DWARFCompileUnit.h"
+#include "DWARFUnit.h"
----------------
And you don't need these headers.

================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:13
@@ -11,1 +12,3 @@
+#include "DWARFUnit.h"
+#include "llvm/Config/config.h"
 #include "llvm/Support/Dwarf.h"
----------------
and this config.h file.

================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:668
@@ +667,3 @@
+  const char *IncludeDir = "";
+  const char *CompilationDir = "";
+
----------------
You don't need this extra variable.

================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:680
@@ +679,3 @@
+      sys::path::is_relative(IncludeDir))
+    CompilationDir = CompDir;
+
----------------
Just call sys::part::append(FilePath, CompDir) here.

================
Comment at: lib/DebugInfo/DWARFDebugLine.cpp:699
@@ +698,3 @@
+  // Take file number and line/column from the row.
+  const DWARFDebugLine::Row &Row = Rows[RowIndex];
+  if (!getFileNameByIndex(Row.File, CompDir, Kind, Result.FileName))
----------------
you may use "const auto& " here.

================
Comment at: lib/DebugInfo/DWARFDebugLine.h:23
@@ -22,1 +22,3 @@
 class raw_ostream;
+class DWARFUnit;
+class DWARFCompileUnit;
----------------
Now you don't need these forward declarations.

================
Comment at: lib/DebugInfo/DWARFDebugLine.h:177
@@ -174,3 +176,3 @@
     // or -1 if there is no such row.
     uint32_t lookupAddress(uint64_t address) const;
 
----------------
Looks like we can make this a private method now (in a separate change, after this one goes in).

================
Comment at: lib/DebugInfo/DWARFDebugLine.h:188
@@ -185,1 +187,3 @@
 
+    bool getFileLineInfoForAddress(uint64_t Address, const char *CompDir, 
+                                   DILineInfoSpecifier::FileLineInfoKind Kind,
----------------
Add a brief comment for this function.

http://reviews.llvm.org/D5354






More information about the llvm-commits mailing list