summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/SourceManager.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-11-01 16:11:14 +0000
committerPavel Labath <labath@google.com>2016-11-01 16:11:14 +0000
commit1408bf7231c22bce70fea5470a865955ee40399b (patch)
tree353d7fa675051c51596081e7a66d6a8efd027877 /lldb/source/Core/SourceManager.cpp
parentb187f5d988e95197e4b8cfa2121ee13c292ad8bc (diff)
downloadbcm5719-llvm-1408bf7231c22bce70fea5470a865955ee40399b.tar.gz
bcm5719-llvm-1408bf7231c22bce70fea5470a865955ee40399b.zip
Remove TimeValue usage from FileSpec.h
Summary: The only usage there was in GetModificationTime(). I also took the opportunity to move this function from FileSpec to the FileSystem class - since we are using FileSpecs to also represent remote files for which we cannot (easily) retrieve modification time, it makes sense to make the decision to get the modification time more explicit. The new function returns a llvm::sys::TimePoint<>. To aid the transition from TimeValue, I have added a constructor to it which enables implicit conversion from a time_point. Reviewers: zturner, clayborg Subscribers: mehdi_amini, tberghammer, danalbert, beanz, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D25392 llvm-svn: 285702
Diffstat (limited to 'lldb/source/Core/SourceManager.cpp')
-rw-r--r--lldb/source/Core/SourceManager.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index f5b56f30768..0959cabf86a 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -18,6 +18,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Stream.h"
+#include "lldb/Host/FileSystem.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -330,22 +331,19 @@ void SourceManager::FindLinesMatchingRegex(FileSpec &file_spec,
SourceManager::File::File(const FileSpec &file_spec,
lldb::DebuggerSP debugger_sp)
: m_file_spec_orig(file_spec), m_file_spec(file_spec),
- m_mod_time(file_spec.GetModificationTime()), m_source_map_mod_id(0),
- m_data_sp(), m_offsets(), m_debugger_wp(debugger_sp) {
+ m_mod_time(FileSystem::GetModificationTime(file_spec)),
+ m_debugger_wp(debugger_sp) {
CommonInitializer(file_spec, nullptr);
}
SourceManager::File::File(const FileSpec &file_spec, Target *target)
: m_file_spec_orig(file_spec), m_file_spec(file_spec),
- m_mod_time(file_spec.GetModificationTime()), m_source_map_mod_id(0),
- m_data_sp(), m_offsets(),
+ m_mod_time(FileSystem::GetModificationTime(file_spec)),
m_debugger_wp(target ? target->GetDebugger().shared_from_this()
: DebuggerSP()) {
CommonInitializer(file_spec, target);
}
-SourceManager::File::~File() {}
-
void SourceManager::File::CommonInitializer(const FileSpec &file_spec,
Target *target) {
if (!m_mod_time.IsValid()) {
@@ -384,7 +382,7 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec,
SymbolContext sc;
sc_list.GetContextAtIndex(0, sc);
m_file_spec = sc.comp_unit;
- m_mod_time = m_file_spec.GetModificationTime();
+ m_mod_time = FileSystem::GetModificationTime(m_file_spec);
}
}
}
@@ -399,7 +397,7 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec,
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;
- m_mod_time = m_file_spec.GetModificationTime();
+ m_mod_time = FileSystem::GetModificationTime(m_file_spec);
}
}
}
@@ -479,7 +477,7 @@ void SourceManager::File::UpdateIfNeeded() {
// TODO: use host API to sign up for file modifications to anything in our
// source cache and only update when we determine a file has been updated.
// For now we check each time we want to display info for the file.
- TimeValue curr_mod_time(m_file_spec.GetModificationTime());
+ TimeValue curr_mod_time(FileSystem::GetModificationTime(m_file_spec));
if (curr_mod_time.IsValid() && m_mod_time != curr_mod_time) {
m_mod_time = curr_mod_time;
OpenPOWER on IntegriCloud