diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-01-09 17:35:07 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-01-10 10:07:39 +0000 |
commit | f73e787bd19e4bb4368499f2b107d7c69208c50f (patch) | |
tree | 8cf6dd0c16dcc0eba073913939ab367f73e28d32 /src/plugins/clangtools/executableinfo.cpp | |
parent | 8d6c16863188b26373a72e4c3c2a775c01fa1fcf (diff) | |
download | qt-creator-f73e787bd19e4bb4368499f2b107d7c69208c50f.tar.gz |
ExecutableInfo: Share getClangIncludeDirAndVersion's cache
Share the common cache with ClangToolRunControl and
DocumentClangToolRunner.
Change-Id: I47c6a1844459e80e9ea0336b5aa72db0265d3a30
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/clangtools/executableinfo.cpp')
-rw-r--r-- | src/plugins/clangtools/executableinfo.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/clangtools/executableinfo.cpp b/src/plugins/clangtools/executableinfo.cpp index c914832d8c..ffdd635b5f 100644 --- a/src/plugins/clangtools/executableinfo.cpp +++ b/src/plugins/clangtools/executableinfo.cpp @@ -214,7 +214,7 @@ QString queryVersion(const FilePath &clangToolPath, QueryFailMode failMode) return {}; } -QPair<FilePath, QString> getClangIncludeDirAndVersion(const FilePath &clangToolPath) +static QPair<FilePath, QString> clangIncludeDirAndVersion(const FilePath &clangToolPath) { const FilePath dynamicResourceDir = queryResourceDir(clangToolPath); const QString dynamicVersion = queryVersion(clangToolPath, QueryFailMode::Noisy); @@ -223,6 +223,15 @@ QPair<FilePath, QString> getClangIncludeDirAndVersion(const FilePath &clangToolP return {dynamicResourceDir / "include", dynamicVersion}; } +QPair<FilePath, QString> getClangIncludeDirAndVersion(const FilePath &clangToolPath) +{ + static QMap<FilePath, QPair<FilePath, QString>> cache; + auto it = cache.find(clangToolPath); + if (it == cache.end()) + it = cache.insert(clangToolPath, clangIncludeDirAndVersion(clangToolPath)); + return it.value(); +} + QHash<Utils::FilePath, QPair<QDateTime, ClazyStandaloneInfo>> ClazyStandaloneInfo::cache; } // namespace Internal |