Skip to content

Commit e3d3533

Browse files
committed
fixed #14547 - store absolute path in FileWithDetails (fixes slow start-up with a lot of input files)
1 parent 09b9094 commit e3d3533

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

cli/cmdlineparser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ bool CmdLineParser::fillSettingsFromArgs(int argc, const char* const argv[])
269269
{
270270
auto it = filesResolved.begin();
271271
while (it != filesResolved.end()) {
272-
const std::string& absname = Path::getAbsoluteFilePath(it->spath());
272+
const std::string& absname = it->abspath();
273273
// TODO: log if duplicated files were dropped
274274
filesResolved.erase(std::remove_if(std::next(it), filesResolved.end(), [&](const FileWithDetails& entry) {
275-
return Path::getAbsoluteFilePath(entry.spath()) == absname;
275+
return entry.abspath() == absname;
276276
}), filesResolved.end());
277277
++it;
278278
}

lib/filesettings.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class FileWithDetails
5050
{
5151
mPath = std::move(path);
5252
mPathSimplified = Path::simplifyPath(mPath);
53+
mPathAbsolute = Path::getAbsoluteFilePath(mPath);
5354
}
5455

5556
const std::string& path() const
@@ -62,6 +63,11 @@ class FileWithDetails
6263
return mPathSimplified;
6364
}
6465

66+
const std::string& abspath() const
67+
{
68+
return mPathAbsolute;
69+
}
70+
6571
std::size_t size() const
6672
{
6773
return mSize;
@@ -89,6 +95,7 @@ class FileWithDetails
8995
private:
9096
std::string mPath;
9197
std::string mPathSimplified;
98+
std::string mPathAbsolute;
9299
Standards::Language mLang = Standards::Language::None;
93100
std::size_t mSize;
94101
std::size_t mFsFileId{0};

0 commit comments

Comments
 (0)