Author: jdevlieghere
Date: Thu Aug 15 16:53:15 2019
New Revision: 369072

URL: http://llvm.org/viewvc/llvm-project?rev=369072&view=rev
Log:
[DebugLine] Don't try to guess the path style

In r368879 I made an attempt to guess the path style from the files in
the line table. After some consideration I now think this is a poor
idea. This patch undoes that behavior and instead adds an optional
argument to specify the path style. This allows us to make that decision
elsewhere where we have more information. In case of LLDB based on the
Unit.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=369072&r1=369071&r2=369072&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Aug 15 
16:53:15 2019
@@ -178,11 +178,10 @@ ParseLLVMLineTable(lldb_private::DWARFCo
   return *line_table;
 }
 
-static FileSpecList
-ParseSupportFilesFromPrologue(const lldb::ModuleSP &module,
-                              const llvm::DWARFDebugLine::Prologue &prologue,
-                              llvm::StringRef compile_dir = {},
-                              FileSpec first_file = {}) {
+static FileSpecList ParseSupportFilesFromPrologue(
+    const lldb::ModuleSP &module,
+    const llvm::DWARFDebugLine::Prologue &prologue, FileSpec::Style style,
+    llvm::StringRef compile_dir = {}, FileSpec first_file = {}) {
   FileSpecList support_files;
   support_files.Append(first_file);
 
@@ -191,8 +190,8 @@ ParseSupportFilesFromPrologue(const lldb
     std::string original_file;
     if (!prologue.getFileNameByIndex(
             idx, compile_dir,
-            llvm::DILineInfoSpecifier::FileLineInfoKind::Default,
-            original_file)) {
+            llvm::DILineInfoSpecifier::FileLineInfoKind::Default, 
original_file,
+            style)) {
       // Always add an entry so the indexes remain correct.
       support_files.EmplaceBack();
       continue;
@@ -202,18 +201,14 @@ ParseSupportFilesFromPrologue(const lldb
     if (!prologue.getFileNameByIndex(
             idx, compile_dir,
             llvm::DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
-            remapped_file)) {
+            remapped_file, style)) {
       // Always add an entry so the indexes remain correct.
-      support_files.EmplaceBack(original_file,
-                                FileSpec::GuessPathStyle(original_file)
-                                    .getValueOr(FileSpec::Style::native));
+      support_files.EmplaceBack(original_file, style);
       continue;
     }
 
     module->RemapSourceFile(llvm::StringRef(original_file), remapped_file);
-    support_files.EmplaceBack(remapped_file,
-                              FileSpec::GuessPathStyle(remapped_file)
-                                  .getValueOr(FileSpec::Style::native));
+    support_files.EmplaceBack(remapped_file, style);
   }
 
   return support_files;
@@ -893,8 +888,8 @@ SymbolFileDWARF::GetTypeUnitSupportFiles
                      "SymbolFileDWARF::GetTypeUnitSupportFiles failed to parse 
"
                      "the line table prologue");
     } else {
-      list =
-          ParseSupportFilesFromPrologue(GetObjectFile()->GetModule(), 
prologue);
+      list = ParseSupportFilesFromPrologue(GetObjectFile()->GetModule(),
+                                           prologue, tu.GetPathStyle());
     }
   }
   return list;
@@ -1013,7 +1008,7 @@ bool SymbolFileDWARF::ParseLineTable(Com
   }
 
   comp_unit.SetSupportFiles(ParseSupportFilesFromPrologue(
-      comp_unit.GetModule(), line_table->Prologue,
+      comp_unit.GetModule(), line_table->Prologue, dwarf_cu->GetPathStyle(),
       dwarf_cu->GetCompilationDirectory().GetCString(), FileSpec(comp_unit)));
 
   return true;


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to