forked from qt-creator/qt-creator
Clang: Improve speed by content generation
The argument parsing has some considerable overhead. We try to avoid that with merging all content together in one file. Change-Id: Icf426bb5d6a5569d59c180f94c7eab66a22a251c Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -37,21 +37,24 @@ class FilePath
|
||||
{
|
||||
public:
|
||||
FilePath() = default;
|
||||
explicit FilePath(const QString &filePath)
|
||||
explicit FilePath(Utils::SmallString &&filePath)
|
||||
{
|
||||
Utils::SmallString utf8FilePath = filePath;
|
||||
|
||||
auto foundReverse = std::find(utf8FilePath.rbegin(), utf8FilePath.rend(), '/');
|
||||
auto foundReverse = std::find(filePath.rbegin(), filePath.rend(), '/');
|
||||
auto found = foundReverse.base();
|
||||
|
||||
Utils::SmallString fileName(found, utf8FilePath.end());
|
||||
if (foundReverse != utf8FilePath.rend())
|
||||
utf8FilePath.resize(std::size_t(std::distance(utf8FilePath.begin(), --found)));
|
||||
Utils::SmallString fileName(found, filePath.end());
|
||||
if (foundReverse != filePath.rend())
|
||||
filePath.resize(std::size_t(std::distance(filePath.begin(), --found)));
|
||||
|
||||
directory_ = std::move(utf8FilePath);
|
||||
directory_ = std::move(filePath);
|
||||
name_ = std::move(fileName);
|
||||
}
|
||||
|
||||
explicit FilePath(const QString &filePath)
|
||||
: FilePath(Utils::SmallString(filePath))
|
||||
{
|
||||
}
|
||||
|
||||
FilePath(Utils::SmallString &&directory, Utils::SmallString &&name)
|
||||
: directory_(std::move(directory)),
|
||||
name_(std::move(name))
|
||||
|
||||
Reference in New Issue
Block a user