Remove the fields of CppCompileAction relating to "extra system include prefixes" and compiler plugins.

They were dead code.

--
MOS_MIGRATED_REVID=121473393
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 76dd500..ed4652a 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
@@ -168,7 +168,6 @@
   private final NestedSet<Artifact> mandatoryInputs;
   private final boolean shouldScanIncludes;
   private final CppCompilationContext context;
-  private final Collection<PathFragment> extraSystemIncludePrefixes;
   private final Iterable<IncludeScannable> lipoScannables;
   private final ImmutableList<Artifact> builtinIncludeFiles;
   @VisibleForTesting public final CppCompileCommandLine cppCompileCommandLine;
@@ -251,9 +250,7 @@
       CppCompilationContext context,
       Class<? extends CppCompileActionContext> actionContext,
       ImmutableList<String> copts,
-      ImmutableList<String> pluginOpts,
       Predicate<String> coptsFilter,
-      ImmutableList<PathFragment> extraSystemIncludePrefixes,
       @Nullable String fdoBuildStamp,
       SpecialInputsHandler specialInputsHandler,
       Iterable<IncludeScannable> lipoScannables,
@@ -277,7 +274,6 @@
     this.dwoFile = dwoFile;
     this.optionalSourceFile = optionalSourceFile;
     this.context = context;
-    this.extraSystemIncludePrefixes = extraSystemIncludePrefixes;
     this.specialInputsHandler = specialInputsHandler;
     this.cppConfiguration = cppConfiguration;
     // inputsKnown begins as the logical negation of shouldScanIncludes.
@@ -293,7 +289,6 @@
             dwoFile,
             copts,
             coptsFilter,
-            pluginOpts,
             features,
             featureConfiguration,
             variables,
@@ -496,15 +491,6 @@
     return outputFile.getExecPath();
   }
 
-  @VisibleForTesting
-  public List<String> getPluginOpts() {
-    return cppCompileCommandLine.pluginOpts;
-  }
-
-  Collection<PathFragment> getExtraSystemIncludePrefixes() {
-    return extraSystemIncludePrefixes;
-  }
-
   @Override
   public Map<Artifact, Artifact> getLegalGeneratedScannerFileMap() {
     Map<Artifact, Artifact> legalOuts = new HashMap<>();
@@ -832,7 +818,7 @@
   private Iterable<PathFragment> getValidationIgnoredDirs() {
     List<PathFragment> cxxSystemIncludeDirs = cppConfiguration.getBuiltInIncludeDirectories();
     return Iterables.concat(
-        cxxSystemIncludeDirs, extraSystemIncludePrefixes, context.getSystemIncludeDirs());
+        cxxSystemIncludeDirs, context.getSystemIncludeDirs());
   }
 
   /**
@@ -962,7 +948,6 @@
           systemIncludePrefixes.add(includePath);
         }
       }
-      systemIncludePrefixes.addAll(extraSystemIncludePrefixes);
 
       // Check inclusions.
       IncludeProblems problems = new IncludeProblems();
@@ -1157,7 +1142,6 @@
     f.addPaths(context.getDeclaredIncludeDirs());
     f.addPaths(context.getDeclaredIncludeWarnDirs());
     f.addPaths(getDeclaredIncludeSrcsInStableOrder());
-    f.addPaths(getExtraSystemIncludePrefixes());
     f.addPaths(Artifact.asSortedPathFragments(getMandatoryInputs()));
     return f.hexDigestAndReset();
   }
@@ -1273,11 +1257,6 @@
       message.append('\n');
     }
 
-    for (PathFragment path : getExtraSystemIncludePrefixes()) {
-      message.append("  Extra system include prefix: ");
-      message.append(ShellEscaper.escapeString(path.getPathString()));
-      message.append('\n');
-    }
     return message.toString();
   }
 
@@ -1290,7 +1269,6 @@
     @Nullable private final Artifact dwoFile;
     private final List<String> copts;
     private final Predicate<String> coptsFilter;
-    private final List<String> pluginOpts;
     private final Collection<String> features;
     private final FeatureConfiguration featureConfiguration;
     @VisibleForTesting public final CcToolchainFeatures.Variables variables;
@@ -1305,7 +1283,6 @@
         @Nullable Artifact dwoFile,
         ImmutableList<String> copts,
         Predicate<String> coptsFilter,
-        ImmutableList<String> pluginOpts,
         Collection<String> features,
         FeatureConfiguration featureConfiguration,
         CcToolchainFeatures.Variables variables,
@@ -1317,7 +1294,6 @@
       this.dwoFile = dwoFile;
       this.copts = Preconditions.checkNotNull(copts);
       this.coptsFilter = coptsFilter;
-      this.pluginOpts = Preconditions.checkNotNull(pluginOpts);
       this.features = Preconditions.checkNotNull(features);
       this.featureConfiguration = featureConfiguration;
       this.variables = variables;
@@ -1356,8 +1332,6 @@
       List<String> options = new ArrayList<>();
       CppConfiguration toolchain = cppConfiguration;
 
-      // pluginOpts has to be added before defaultCopts because -fplugin must precede -plugin-arg.
-      options.addAll(pluginOpts);
       addFilteredOptions(options, toolchain.getCompilerOptions(features));
 
       String sourceFilename = sourceFile.getExecPathString();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
index 81ae914..c3f34da 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileActionBuilder.java
@@ -59,7 +59,6 @@
   private final Artifact sourceFile;
   private final Label sourceLabel;
   private final NestedSetBuilder<Artifact> mandatoryInputsBuilder;
-  private NestedSetBuilder<Artifact> pluginInputsBuilder;
   private Artifact optionalSourceFile;
   private Artifact outputFile;
   private PathFragment tempOutputFile;
@@ -96,7 +95,6 @@
     this.sourceLabel = sourceLabel;
     this.configuration = ruleContext.getConfiguration();
     this.mandatoryInputsBuilder = NestedSetBuilder.stableOrder();
-    this.pluginInputsBuilder = NestedSetBuilder.stableOrder();
     this.lipoScannableMap = getLipoScannableMap(ruleContext);
     this.ruleContext = ruleContext;
 
@@ -118,28 +116,6 @@
   }
 
   /**
-   * Creates a builder for an owner that is not required to be rule.
-   * 
-   * <p>If errors are found when creating the {@code CppCompileAction}, builders constructed
-   * this way will throw a runtime exception.
-   */
-  @VisibleForTesting
-  public CppCompileActionBuilder(
-      ActionOwner owner, AnalysisEnvironment analysisEnvironment, Artifact sourceFile,
-      Label sourceLabel, BuildConfiguration configuration) {
-    this.owner = owner;
-    this.actionContext = CppCompileActionContext.class;
-    this.cppConfiguration = configuration.getFragment(CppConfiguration.class);
-    this.analysisEnvironment = analysisEnvironment;
-    this.sourceFile = sourceFile;
-    this.sourceLabel = sourceLabel;
-    this.configuration = configuration;
-    this.mandatoryInputsBuilder = NestedSetBuilder.stableOrder();
-    this.pluginInputsBuilder = NestedSetBuilder.stableOrder();
-    this.lipoScannableMap = ImmutableMap.of();
-  }
-
-  /**
    * Creates a builder that is a copy of another builder.
    */
   public CppCompileActionBuilder(CppCompileActionBuilder other) {
@@ -150,8 +126,6 @@
     this.sourceLabel = other.sourceLabel;
     this.mandatoryInputsBuilder = NestedSetBuilder.<Artifact>stableOrder()
         .addTransitive(other.mandatoryInputsBuilder.build());
-    this.pluginInputsBuilder = NestedSetBuilder.<Artifact>stableOrder()
-        .addTransitive(other.pluginInputsBuilder.build());
     this.optionalSourceFile = other.optionalSourceFile;
     this.outputFile = other.outputFile;
     this.tempOutputFile = other.tempOutputFile;
@@ -296,7 +270,6 @@
     }
     realMandatoryInputsBuilder.addTransitive(context.getAdditionalInputs(usePic));
 
-    realMandatoryInputsBuilder.addTransitive(pluginInputsBuilder.build());
     realMandatoryInputsBuilder.add(sourceFile);
     boolean fake = tempOutputFile != null;
 
@@ -315,8 +288,8 @@
           variables, sourceFile, shouldScanIncludes, sourceLabel,
           realMandatoryInputsBuilder.build(), outputFile,
           tempOutputFile, dotdFile, configuration, cppConfiguration, context, actionContext,
-          ImmutableList.copyOf(copts), ImmutableList.copyOf(pluginOpts),
-          getNocoptPredicate(nocopts), extraSystemIncludePrefixes, fdoBuildStamp, ruleContext,
+          ImmutableList.copyOf(copts),
+          getNocoptPredicate(nocopts), fdoBuildStamp, ruleContext,
           usePic);
     } else {
       NestedSet<Artifact> realMandatoryInputs = realMandatoryInputsBuilder.build();
@@ -340,9 +313,7 @@
           context,
           actionContext,
           ImmutableList.copyOf(copts),
-          ImmutableList.copyOf(pluginOpts),
           getNocoptPredicate(nocopts),
-          extraSystemIncludePrefixes,
           fdoBuildStamp,
           specialInputsHandler,
           getLipoScannables(realMandatoryInputs),
@@ -393,22 +364,6 @@
     return this;
   }
 
-  public CppCompileActionBuilder setExtraSystemIncludePrefixes(
-      Collection<PathFragment> extraSystemIncludePrefixes) {
-    this.extraSystemIncludePrefixes = ImmutableList.copyOf(extraSystemIncludePrefixes);
-    return this;
-  }
-
-  public CppCompileActionBuilder addPluginInput(Artifact artifact) {
-    pluginInputsBuilder.add(artifact);
-    return this;
-  }
-
-  public CppCompileActionBuilder clearPluginInputs() {
-    pluginInputsBuilder = NestedSetBuilder.stableOrder();
-    return this;
-  }
-
   /**
    * Set an optional source file (usually with metadata of the main source file). The optional
    * source file can only be set once, whether via this method or through the constructor
@@ -481,16 +436,6 @@
     return this;
   }
 
-  public CppCompileActionBuilder addPluginOpt(String opt) {
-    pluginOpts.add(opt);
-    return this;
-  }
-
-  public CppCompileActionBuilder clearPluginOpts() {
-    pluginOpts.clear();
-    return this;
-  }
-
   public CppCompileActionBuilder addCopts(Iterable<? extends String> copts) {
     Iterables.addAll(this.copts, copts);
     return this;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
index 80cbb21..65c158d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppModel.java
@@ -65,7 +65,6 @@
   private CppCompilationContext interfaceContext;
   private final List<Pair<Artifact, Label>> sourceFiles = new ArrayList<>();
   private final List<String> copts = new ArrayList<>();
-  private final List<PathFragment> additionalIncludes = new ArrayList<>();
   @Nullable private Pattern nocopts;
   private boolean fake;
   private boolean maySaveTemps;
@@ -172,16 +171,6 @@
   }
 
   /**
-   * This can be used to specify additional include directories, without modifying the compilation
-   * context.
-   */
-  public CppModel addAdditionalIncludes(Collection<PathFragment> additionalIncludes) {
-    // TODO(bazel-team): Maybe this could be handled by the compilation context instead?
-    this.additionalIncludes.addAll(additionalIncludes);
-    return this;
-  }
-
-  /**
    * Adds the given linkopts to the optional dynamic library link command.
    */
   public CppModel addLinkopts(Collection<String> linkopts) {
@@ -319,7 +308,6 @@
       builder.addNocopts(nocopts);
     }
 
-    builder.setExtraSystemIncludePrefixes(additionalIncludes);
     builder.setFdoBuildStamp(CppHelper.getFdoBuildStamp(ruleContext));
     builder.setFeatureConfiguration(featureConfiguration);
     
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
index 75638ee..a24cc84 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/FakeCppCompileAction.java
@@ -77,9 +77,7 @@
       CppCompilationContext context,
       Class<? extends CppCompileActionContext> actionContext,
       ImmutableList<String> copts,
-      ImmutableList<String> pluginOpts,
       Predicate<String> nocopts,
-      ImmutableList<PathFragment> extraSystemIncludePrefixes,
       @Nullable String fdoBuildStamp,
       RuleContext ruleContext,
       boolean usePic) {
@@ -109,9 +107,7 @@
         CppCompilationContext.disallowUndeclaredHeaders(context),
         actionContext,
         copts,
-        pluginOpts,
         nocopts,
-        extraSystemIncludePrefixes,
         fdoBuildStamp,
         VOID_SPECIAL_INPUTS_HANDLER,
         ImmutableList.<IncludeScannable>of(),