[Lldb-commits] [lldb] r347660 - Move time cast to SymbolFileDWARFDebugMap

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 27 07:25:58 PST 2018


Author: jdevlieghere
Date: Tue Nov 27 07:25:58 2018
New Revision: 347660

URL: http://llvm.org/viewvc/llvm-project?rev=347660&view=rev
Log:
Move time cast to SymbolFileDWARFDebugMap

When trying to fix the bots we expected that the cast would be needed in
different places. Ultimately it turned out only the
SymbolFileDWARFDebugMap was affected so, as Pavel correctly notes, it
makes more sense to do the cast just there instead of in teh FS.

Modified:
    lldb/trunk/include/lldb/Host/FileSystem.h
    lldb/trunk/source/Host/common/FileSystem.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347660&r1=347659&r2=347660&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Tue Nov 27 07:25:58 2018
@@ -56,12 +56,8 @@ public:
 
   /// Returns the modification time of the given file.
   /// @{
-  llvm::sys::TimePoint<>
-  GetModificationTime(const FileSpec &file_spec,
-                      bool nanosecond_precision = true) const;
-  llvm::sys::TimePoint<>
-  GetModificationTime(const llvm::Twine &path,
-                      bool nanosecond_precision = true) const;
+  llvm::sys::TimePoint<> GetModificationTime(const FileSpec &file_spec) const;
+  llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine &path) const;
   /// @}
 
   /// Returns the on-disk size of the given file in bytes.

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347660&r1=347659&r2=347660&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Tue Nov 27 07:25:58 2018
@@ -64,22 +64,15 @@ Optional<FileSystem> &FileSystem::Instan
 }
 
 sys::TimePoint<>
-FileSystem::GetModificationTime(const FileSpec &file_spec,
-                                bool nanosecond_precision) const {
-  return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
+FileSystem::GetModificationTime(const FileSpec &file_spec) const {
+  return GetModificationTime(file_spec.GetPath());
 }
 
-sys::TimePoint<>
-FileSystem::GetModificationTime(const Twine &path,
-                                bool nanosecond_precision) const {
+sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const {
   ErrorOr<vfs::Status> status = m_fs->status(path);
   if (!status)
     return sys::TimePoint<>();
-  if (nanosecond_precision)
-    return status->getLastModificationTime();
-  else
-    return std::chrono::time_point_cast<std::chrono::seconds>(
-        status->getLastModificationTime());
+  return status->getLastModificationTime();
 }
 
 uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347660&r1=347659&r2=347660&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue Nov 27 07:25:58 2018
@@ -86,8 +86,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
       const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1;
       for (uint32_t idx = comp_unit_info->first_symbol_index +
                           2; // Skip the N_SO and N_OSO
-           idx < oso_end_idx;
-           ++idx) {
+           idx < oso_end_idx; ++idx) {
         Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx);
         if (exe_symbol) {
           if (exe_symbol->IsDebug() == false)
@@ -420,8 +419,10 @@ Module *SymbolFileDWARFDebugMap::GetModu
       FileSpec oso_file(oso_path);
       ConstString oso_object;
       if (FileSystem::Instance().Exists(oso_file)) {
-        auto oso_mod_time = FileSystem::Instance().GetModificationTime(
-            oso_file, /*nanosecond_precision=*/false);
+        // The modification time returned by the FS can have a higher precision
+        // than the one from the CU.
+        auto oso_mod_time = std::chrono::time_point_cast<std::chrono::seconds>(
+            FileSystem::Instance().GetModificationTime(oso_file));
         if (oso_mod_time != comp_unit_info->oso_mod_time) {
           obj_file->GetModule()->ReportError(
               "debug map object file '%s' has changed (actual time is "
@@ -802,8 +803,7 @@ uint32_t SymbolFileDWARFDebugMap::Privat
     const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
     const std::vector<uint32_t>
         &indexes, // Indexes into the symbol table that match "name"
-    uint32_t max_matches,
-    VariableList &variables) {
+    uint32_t max_matches, VariableList &variables) {
   const uint32_t original_size = variables.GetSize();
   const size_t match_count = indexes.size();
   for (size_t i = 0; i < match_count; ++i) {




More information about the lldb-commits mailing list