[PATCH] D80168: For --relativenames, handle dwarf absolute include directories similarly to compilation directories.
Sterling Augustine via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 21 10:15:39 PDT 2020
saugustine updated this revision to Diff 265528.
saugustine marked an inline comment as done.
saugustine added a comment.
Address comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80168/new/
https://reviews.llvm.org/D80168
Files:
llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/test/tools/llvm-symbolizer/relativenames.s
Index: llvm/test/tools/llvm-symbolizer/relativenames.s
===================================================================
--- llvm/test/tools/llvm-symbolizer/relativenames.s
+++ llvm/test/tools/llvm-symbolizer/relativenames.s
@@ -8,11 +8,16 @@
# RUN: llvm-symbolizer 0 --relativenames --obj=%t.o \
# RUN: | FileCheck %s -DDIR=%p --check-prefix=RELATIVENAMES
+## Sanity check for default.
+# RUN: llvm-symbolizer 0 --obj=%t.o \
+# RUN: | FileCheck %s -DDIR=%p --check-prefix=ABSOLUTENAMES
+
## Ensure last option wins.
# RUN: llvm-symbolizer 0 --basenames --relativenames --obj=%t.o \
# RUN: | FileCheck %s -DDIR=%p --check-prefix=RELATIVENAMES
# RUN: llvm-symbolizer 0 --relativenames --basenames --obj=%t.o \
# RUN: | FileCheck %s --check-prefix=BASENAMES
-# RELATIVENAMES: [[DIR]]{{\\|/}}relativenames.s:4
+# ABSOLUTENAMES: [[DIR]]{{\\|/}}relativenames.s:4
+# RELATIVENAMES: {{^}}relativenames.s:4
# BASENAMES: {{^}}relativenames.s:4
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -1230,6 +1230,17 @@
IncludeDir =
IncludeDirectories[Entry.DirIdx - 1].getAsCString().getValue();
}
+
+ // An include directory may be relative to the compilation directory, or may
+ // be an absolute path itself, similar to the compilation directory. Handle an
+ // absolute-path include directory the same as an absolute-path compilation
+ // directory.
+ if (Kind == FileLineInfoKind::RelativeFilePath &&
+ isPathAbsoluteOnWindowsOrPosix(IncludeDir)) {
+ Result = std::string(llvm::sys::path::filename(FileName));
+ return true;
+ }
+
// For absolute paths only, include the compilation directory of compile unit.
// We know that FileName is not absolute, the only way to have an absolute
// path at this point would be if IncludeDir is absolute.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80168.265528.patch
Type: text/x-patch
Size: 1975 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200521/c88d5181/attachment.bin>
More information about the llvm-commits
mailing list