/*
 * Copyright 2016-present Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package com.facebook.buck.cxx.toolchain;

import com.facebook.buck.core.toolchain.tool.Tool;
import com.google.common.collect.ImmutableList;
import java.nio.file.Path;

/** Subclass of WindowsCompiler with overrides specific for clang-cl. */
public class ClangClCompiler extends WindowsCompiler {

  public ClangClCompiler(Tool tool) {
    super(tool);
  }

  @Override
  public ImmutableList<String> getFlagsForReproducibleBuild(
      String altCompilationDir, Path currentCellPath) {
    return ImmutableList.of(
        "/Brepro", "-Xclang", "-fdebug-compilation-dir", "-Xclang", altCompilationDir);
  }
}

@@ -692,16 +692,63 @@
 l.Tool;%0A
+import com.facebook.buck.util.ProcessExecutor;%0A
 import c
@@ -813,16 +813,43 @@
 le.Path;
+%0Aimport java.util.Optional;
 %0A%0A/** Su
@@ -1280,11 +1280,156 @@
 ir);%0A  %7D
+%0A%0A  @Override%0A  public Optional%3CString%3E getStderr(ProcessExecutor.Result result) %7B%0A    // clang-cl is sensible%0A    return result.getStderr();%0A  %7D
 %0A%7D%0A

Fix diagnostics output for clang-cl