public CxxInferCapture createInferCaptureBuildRule(
      BuildTarget target, String name, CxxSource source, CxxInferTools inferTools) {
    Preconditions.checkArgument(CxxSourceTypes.isPreprocessableType(source.getType()));

    LOG.verbose("Creating preprocessed InferCapture build rule %s for %s", target, source);

    CxxInferCapture result =
        new CxxInferCapture(
            getParams()
                .copyWithChanges(
                    target,
                    new DepsBuilder().addPreprocessDeps().add(source),
                    Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of())),
            getPathResolver(),
            CxxToolFlags.copyOf(
                CxxSourceTypes.getPlatformPreprocessFlags(getCxxPlatform(), source.getType()),
                preprocessorFlags.getUnchecked(source.getType())),
            computeCompilerFlags(source.getType(), source.getFlags()),
            source.getPath(),
            source.getType(),
            getCompileOutputPath(target, name),
            getIncludeRoots(),
            getSystemIncludeRoots(),
            getHeaderMaps(),
            getFrameworks(),
            CxxDescriptionEnhancer.frameworkPathToSearchPath(getCxxPlatform(), getPathResolver()),
            getPrefixHeader(),
            inferTools,
            getCxxPlatform().getDebugPathSanitizer());
    getResolver().addToIndex(result);
    return result;
  }
 @Override
 public PreprocessorDelegate load(@Nonnull PreprocessAndCompilePreprocessorDelegateKey key)
     throws Exception {
   return new PreprocessorDelegate(
       getPathResolver(),
       getCxxPlatform().getDebugPathSanitizer(),
       getParams().getProjectFilesystem().getRootPath(),
       CxxSourceTypes.getPreprocessor(getCxxPlatform(), key.getSourceType()),
       computePreprocessorFlags(key.getSourceType(), key.getSourceFlags()),
       getIncludeRoots(),
       getSystemIncludeRoots(),
       getHeaderMaps(),
       getFrameworks(),
       CxxDescriptionEnhancer.frameworkPathToSearchPath(getCxxPlatform(), getPathResolver()),
       getPrefixHeader(),
       getIncludes());
 }