forked from OSchip/llvm-project
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. llvm-svn: 347660
This commit is contained in:
parent
443a7f9788
commit
010b56be0d
|
@ -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.
|
||||
|
|
|
@ -64,22 +64,15 @@ Optional<FileSystem> &FileSystem::InstanceImpl() {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -86,8 +86,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(
|
|||
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::GetModuleByCompUnitInfo(
|
|||
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::PrivateFindGlobalVariables(
|
|||
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) {
|
||||
|
|
Loading…
Reference in New Issue