summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/FileSpec.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-02-11 14:11:00 +0000
committerPavel Labath <pavel@labath.sk>2019-02-11 14:11:00 +0000
commit841bea933bfc1ea8d925de66add80227f1dfbe83 (patch)
treecb067ffc3c22278056032193ba7305f40839451d /lldb/source/Utility/FileSpec.cpp
parentc1adbc6c94e4c5782d09514711dbac32edf413c3 (diff)
downloadbcm5719-llvm-841bea933bfc1ea8d925de66add80227f1dfbe83.tar.gz
bcm5719-llvm-841bea933bfc1ea8d925de66add80227f1dfbe83.zip
Breakpad: auto-detect path style of file entries
Summary: This adds support for auto-detection of path style to SymbolFileBreakpad (similar to how r351328 did the same for DWARF). We guess each file entry separately, as we have no idea which file came from which compile units (and different compile units can have different path styles). The breakpad generates should have already converted the paths to absolute ones, so this guess should be reasonable accurate, but as always with these kinds of things, it is hard to give guarantees about anything. In an attempt to bring some unity to the path guessing logic, I move the guessing logic from inside SymbolFileDWARF into the FileSpec class and have both symbol files use it to implent their desired behavior. Reviewers: clayborg, lemo, JDevlieghere Subscribers: aprantl, markmentovai, lldb-commits Differential Revision: https://reviews.llvm.org/D57895 llvm-svn: 353702
Diffstat (limited to 'lldb/source/Utility/FileSpec.cpp')
-rw-r--r--lldb/source/Utility/FileSpec.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index 25d2278fe67..38ce36a18ac 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -365,6 +365,17 @@ bool FileSpec::Equal(const FileSpec &a, const FileSpec &b, bool full) {
return a == b;
}
+llvm::Optional<FileSpec::Style> FileSpec::GuessPathStyle(llvm::StringRef absolute_path) {
+ if (absolute_path.startswith("/"))
+ return Style::posix;
+ if (absolute_path.startswith(R"(\\)"))
+ return Style::windows;
+ if (absolute_path.size() > 3 && llvm::isAlpha(absolute_path[0]) &&
+ absolute_path.substr(1, 2) == R"(:\)")
+ return Style::windows;
+ return llvm::None;
+}
+
//------------------------------------------------------------------
// Dump the object to the supplied stream. If the object contains a valid
// directory name, it will be displayed followed by a directory delimiter, and
OpenPOWER on IntegriCloud