diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-12 13:10:33 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-12-19 15:07:34 +0000 |
commit | 21e82bbbe316f582ee11c8996e24e402f9342606 (patch) | |
tree | df3ac27e814e83f0cf914944bcf3f354fad64638 /src/lib/corelib/buildgraph/inputartifactscanner.cpp | |
parent | d3b1bf682181277e03299b1567631e144df12a67 (diff) |
Merge the C/C++ include scanners
We had one scanner for every type of file in the C family, all of which
collected the same set of includes, but under a different entry in the
scanner cache. Thus, lots of header files were unnecessarily re-scanned.
We fix this by making the scanner plugins declare a *list* of tags they
can handle and passing the currently active tags in the open() function.
========== Performance data for Rule Execution ==========
Old instruction count: 3775190973
New instruction count: 3441085735
Relative change: -9 %
Old peak memory usage: 18174216 Bytes
New peak memory usage: 17307600 Bytes
Relative change: -5 %
Change-Id: I222d1ec4bbfbc06ecd8c81faa55a500bc0da1ee6
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/inputartifactscanner.cpp')
-rw-r--r-- | src/lib/corelib/buildgraph/inputartifactscanner.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/corelib/buildgraph/inputartifactscanner.cpp b/src/lib/corelib/buildgraph/inputartifactscanner.cpp index 560ac0a9f..882b9627c 100644 --- a/src/lib/corelib/buildgraph/inputartifactscanner.cpp +++ b/src/lib/corelib/buildgraph/inputartifactscanner.cpp @@ -115,16 +115,6 @@ static void resolveDepencency(const ScanResultCache::Dependency &dependency, result->filePath = absFilePath; } -static void scanWithScannerPlugin(DependencyScanner *scanner, - FileResourceBase *fileToBeScanned, - ScanResultCache::Result *scanResult) -{ - QStringList dependencies = scanner->collectDependencies(fileToBeScanned); - foreach (const QString &s, dependencies) - scanResult->deps += ScanResultCache::Dependency(s); - scanResult->valid = true; -} - InputArtifactScanner::InputArtifactScanner(Artifact *artifact, InputArtifactScannerContext *ctx, const Logger &logger) : m_artifact(artifact), m_context(ctx), m_newDependencyAdded(false), m_logger(logger) @@ -176,6 +166,10 @@ void InputArtifactScanner::scanForFileDependencies(Artifact *inputArtifact) QList<FileResourceBase *> filesToScan; filesToScan.append(inputArtifact); const QSet<DependencyScanner *> scanners = scannersForArtifact(inputArtifact); + if (scanners.isEmpty()) + return; + m_fileTagsForScanner = inputArtifact->fileTags().toStringList().join(QLatin1Char(',')) + .toLatin1().constData(); while (!filesToScan.isEmpty()) { FileResourceBase *fileToBeScanned = filesToScan.takeFirst(); const QString &filePathToBeScanned = fileToBeScanned->filePath(); @@ -364,6 +358,17 @@ void InputArtifactScanner::handleDependency(ResolvedDependency &dependency) } } +void InputArtifactScanner::scanWithScannerPlugin(DependencyScanner *scanner, + FileResourceBase *fileToBeScanned, + ScanResultCache::Result *scanResult) +{ + const QStringList &dependencies + = scanner->collectDependencies(fileToBeScanned, m_fileTagsForScanner); + for (const QString &s : dependencies) + scanResult->deps += ScanResultCache::Dependency(s); + scanResult->valid = true; +} + InputArtifactScannerContext::DependencyScannerCacheItem::DependencyScannerCacheItem() : valid(false) { } |