Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDoug Schaefer2017-05-02 03:26:21 +0000
committerGerrit Code Review @ Eclipse.org2017-05-02 14:14:13 +0000
commit582a7c10d543b637941152af86408eef06ee3a18 (patch)
treebef7242abadb9b0f5ec1383553efba4c1596f7ad /core
parentdb6790d824ef5fe769f10f1e0ceb64ad841f121e (diff)
downloadorg.eclipse.cdt-582a7c10d543b637941152af86408eef06ee3a18.tar.gz
org.eclipse.cdt-582a7c10d543b637941152af86408eef06ee3a18.tar.xz
org.eclipse.cdt-582a7c10d543b637941152af86408eef06ee3a18.zip
Bug 515990 - Fix constant reindexing in CMake projects
There were issues with how the Core Build calculated whether reindexing was required due to compiler settings changes. Also if a source file was built more than once in a CMake build, it ended up always triggering a reindexing since the second instance looked like a settings change. We now only use the last compile command for a file. Change-Id: Icf2922e527ae20e0c3b0dae898d981d334013109
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java7
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ScannerInfoCache.java14
2 files changed, 18 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
index c3daf8b8fb2..6f6a1fb38b0 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/CBuildConfiguration.java
@@ -633,15 +633,18 @@ public abstract class CBuildConfiguration extends PlatformObject
for (IResource resource : resources) {
loadScannerInfoCache();
if (scannerInfoCache.hasCommand(commandStrings)) {
- scannerInfoCache.addResource(commandStrings, resource);
+ if (!scannerInfoCache.hasResource(commandStrings, resource)) {
+ scannerInfoCache.addResource(commandStrings, resource);
+ infoChanged = true;
+ }
} else {
Path commandPath = findCommand(command.get(0));
command.set(0, commandPath.toString());
IExtendedScannerInfo info = getToolChain().getScannerInfo(getBuildConfiguration(),
command, null, resource, getBuildDirectoryURI());
scannerInfoCache.addScannerInfo(commandStrings, info, resource);
+ infoChanged = true;
}
- infoChanged = true;
}
return true;
} else {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ScannerInfoCache.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ScannerInfoCache.java
index 81f9ee74b7c..d055ce85f8b 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ScannerInfoCache.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/ScannerInfoCache.java
@@ -77,7 +77,7 @@ public class ScannerInfoCache {
oldCommand.resourcePaths.remove(resourcePath);
if (oldCommand.resourcePaths.isEmpty()) {
// unused, remove
- commandMap.remove(commandStrings);
+ commandMap.remove(oldCommand.command);
commands.remove(oldCommand);
resourceMap.remove(resourcePath);
}
@@ -101,6 +101,18 @@ public class ScannerInfoCache {
}
}
+ /**
+ * @since 6.3
+ */
+ public boolean hasResource(List<String> commandStrings, IResource resource) {
+ String resourcePath = resource.getLocation().toOSString();
+ Command command = commandMap.get(commandStrings);
+ if (command == null) {
+ return false;
+ }
+ return command.resourcePaths.contains(resourcePath);
+ }
+
public void addResource(List<String> commandStrings, IResource resource) {
String resourcePath = resource.getLocation().toOSString();
Command command = commandMap.get(commandStrings);

Back to the top