aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Core/SourceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Core/SourceManager.cpp')
-rw-r--r--lldb/source/Core/SourceManager.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index e79fcb48742d..9c1112979c54 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -35,8 +35,8 @@
#include <memory>
#include <utility>
-#include <assert.h>
-#include <stdio.h>
+#include <cassert>
+#include <cstdio>
namespace lldb_private {
class ExecutionContext;
@@ -61,7 +61,7 @@ SourceManager::SourceManager(const DebuggerSP &debugger_sp)
m_debugger_wp(debugger_sp) {}
// Destructor
-SourceManager::~SourceManager() {}
+SourceManager::~SourceManager() = default;
SourceManager::FileSP SourceManager::GetFile(const FileSpec &file_spec) {
if (!file_spec)
@@ -441,13 +441,17 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec,
}
// Try remapping if m_file_spec does not correspond to an existing file.
if (!FileSystem::Instance().Exists(m_file_spec)) {
- FileSpec new_file_spec;
- // Check target specific source remappings first, then fall back to
- // modules objects can have individual path remappings that were
- // detected when the debug info for a module was found. then
- if (target->GetSourcePathMap().FindFile(m_file_spec, new_file_spec) ||
- target->GetImages().FindSourceFile(m_file_spec, new_file_spec)) {
- m_file_spec = new_file_spec;
+ // Check target specific source remappings (i.e., the
+ // target.source-map setting), then fall back to the module
+ // specific remapping (i.e., the .dSYM remapping dictionary).
+ auto remapped = target->GetSourcePathMap().FindFile(m_file_spec);
+ if (!remapped) {
+ FileSpec new_spec;
+ if (target->GetImages().FindSourceFile(m_file_spec, new_spec))
+ remapped = new_spec;
+ }
+ if (remapped) {
+ m_file_spec = *remapped;
m_mod_time = FileSystem::Instance().GetModificationTime(m_file_spec);
}
}