@VisibleForTesting
  public CxxPreprocessAndCompile createPreprocessBuildRule(String name, CxxSource source) {

    Preconditions.checkArgument(CxxSourceTypes.isPreprocessableType(source.getType()));

    BuildTarget target = createPreprocessBuildTarget(name, source.getType());
    PreprocessorDelegate preprocessorDelegate =
        preprocessorDelegates.getUnchecked(
            PreprocessAndCompilePreprocessorDelegateKey.of(source.getType(), source.getFlags()));

    // Build the CxxCompile rule and add it to our sorted set of build rules.
    CxxPreprocessAndCompile result =
        CxxPreprocessAndCompile.preprocess(
            getParams()
                .copyWithChanges(
                    target,
                    new DepsBuilder()
                        .addPreprocessDeps()
                        .add(preprocessorDelegate.getPreprocessor())
                        .add(source),
                    Suppliers.ofInstance(ImmutableSortedSet.<BuildRule>of())),
            getPathResolver(),
            preprocessorDelegate,
            new CompilerDelegate(
                getPathResolver(),
                getCxxPlatform().getDebugPathSanitizer(),
                getCompiler(source.getType()),
                computeCompilerFlags(source.getType(), source.getFlags())),
            getPreprocessOutputPath(target, source.getType(), name),
            source.getPath(),
            source.getType(),
            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());
 }