[llvm] [bazel] Disable `-Wmicrosoft-include` for RISCVCodeGen under clang-cl (PR #227867)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 08:57:02 PDT 2026


https://github.com/UebelAndre updated https://github.com/llvm/llvm-project/pull/227867

>From 8d315ac0f953e2d59c383a4fa499357d6ce03f08 Mon Sep 17 00:00:00 2001
From: UebelAndre <github at uebelandre.com>
Date: Wed, 30 Sep 2026 13:53:48 -0700
Subject: [PATCH] [bazel] Disable `-Wmicrosoft-include` for RISCVCodeGen under
 clang-cl

---
 utils/bazel/llvm-project-overlay/llvm/BUILD.bazel | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
index c0d95afc4ffa7..d7db0f6581a24 100644
--- a/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -3233,6 +3233,16 @@ llvm_target_lib_list = [lib for lib in [
     {
         "name": "RISCV",
         "short_name": "RISCV",
+        # MCTargetDesc/RISCVTargetStreamer.h does `#include "RISCV.h"` from
+        # the parent directory. From RISCVAsmPrinter.cpp, MSVC's include-stack
+        # rule finds the real file while the normal search hits a
+        # `_virtual_includes` copy first (copied, not symlinked, on Windows).
+        # clang-cl reports the mismatch under -Wmicrosoft-include, fatal with
+        # -Werror. Same header either way; CMake avoids it via -I<target dir>.
+        "codegen_copts": select({
+            ":is_windows_clang_cl": ["/clang:-Wno-microsoft-include"],
+            "//conditions:default": [],
+        }),
         "tbl_outs": [
             (
                 ["-gen-asm-matcher"],



More information about the llvm-commits mailing list