[Lldb-commits] [lldb] bd67468 - Check that a FileSpec has a Directory component before using
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Thu May 26 11:12:45 PDT 2022
Author: Jason Molenda
Date: 2022-05-26T11:12:37-07:00
New Revision: bd67468645c08a96aec7839c30385956edd88021
URL: https://github.com/llvm/llvm-project/commit/bd67468645c08a96aec7839c30385956edd88021
DIFF: https://github.com/llvm/llvm-project/commit/bd67468645c08a96aec7839c30385956edd88021.diff
LOG: Check that a FileSpec has a Directory component before using
A follow on to my patch for https://reviews.llvm.org/D126435
hit by an x86_64 linux bot; I assumed that a FileSpec had a
directory component and checked if the first character was a
'~'. This was not a valid assumption.
Added:
Modified:
lldb/source/Core/SourceManager.cpp
Removed:
################################################################################
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index d4e1791aa3e46..0e2157f377e0a 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -51,6 +51,7 @@ static inline bool is_newline_char(char ch) { return ch == '\n' || ch == '\r'; }
static void resolve_tilde(FileSpec &file_spec) {
if (!FileSystem::Instance().Exists(file_spec) &&
+ file_spec.GetDirectory() &&
file_spec.GetDirectory().GetCString()[0] == '~') {
FileSystem::Instance().Resolve(file_spec);
}
More information about the lldb-commits
mailing list