aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar Ulf Adams <ulfjack@google.com>2017-02-16 18:41:40 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-17 14:52:24 +0000
commit8bae4f4e99594118b7ce651f7779f92e7683cdd0 (patch)
treedf88c35d6ef72d0c760db013e67d40113751006d /src/main/java/com/google/devtools
parent748f8af16b2648faa9569ae7bc77d93a7a2fbd67 (diff)
CppCompileAction must return false from inputsKnown for .d pruning
This is necessary (but not sufficient) for the action cache to work correctly. Consider the following sequence of events: 1. action is executed 2. .d pruning is performed 3. action cache writes entry with post-pruning inputs list 4. action gets regenerated (e.g., due to server restart) 5. the action cache calls inputsKnown(), which returns true 6. action cache checks entry from step 3 against pre-pruning inputs list, which results in a cache miss The action cache needs to know that the current list is not the final list, so inputsKnown() in step 5 must return false if .d pruning is enabled. This is a step towards resolving #2490. -- PiperOrigin-RevId: 147738367 MOS_MIGRATED_REVID=147738367
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
index 3f8437087f..7f433726c6 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java
@@ -334,9 +334,11 @@ public class CppCompileAction extends AbstractAction
// the inputs are as declared, hence known, and remain so.
this.shouldScanIncludes = shouldScanIncludes;
this.shouldPruneModules = shouldPruneModules;
+ // We can only prune modules if include scanning is enabled.
+ Preconditions.checkArgument(!shouldPruneModules || shouldScanIncludes, this);
this.usePic = usePic;
this.useHeaderModules = useHeaderModules;
- this.inputsKnown = !shouldScanIncludes;
+ this.inputsKnown = !shouldScanIncludes && !cppSemantics.needsDotdInputPruning();
this.cppCompileCommandLine =
new CppCompileCommandLine(
sourceFile, dotdFile, copts, coptsFilter, features, variables, actionName);