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:
Marco Bubke
2017-02-16 18:25:19 +01:00
parent 3ecee265c6
commit 1a75db12f4
14 changed files with 217 additions and 85 deletions

View File

@@ -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))