ychen created this revision.
ychen added a reviewer: GMNGeoffrey.
ychen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Giving Bazel a try on Win10 by following the README. It needs these fixes
to build through. Think that I should sent it out in case it is useful.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112353

Files:
  clang/unittests/libclang/TestUtils.h
  utils/bazel/llvm-project-overlay/clang/BUILD.bazel
  utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
  utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
  utils/bazel/llvm-project-overlay/llvm/config.bzl
  utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h

Index: utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
+++ utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
@@ -174,7 +174,7 @@
 #define HAVE_PTHREAD_GETSPECIFIC 1
 
 /* Define to 1 if you have the <pthread.h> header file. */
-#define HAVE_PTHREAD_H 1
+/* HAVE_PTHREAD_H defined in Bazel */
 
 /* Have pthread_mutex_lock */
 #define HAVE_PTHREAD_MUTEX_LOCK 1
@@ -186,7 +186,7 @@
 /* HAVE_SBRK defined in Bazel */
 
 /* Define to 1 if you have the `setenv' function. */
-#define HAVE_SETENV 1
+/* HAVE_SETENV defined in Bazel */
 
 /* Define to 1 if you have the `setrlimit' function. */
 #define HAVE_SETRLIMIT 1
@@ -216,7 +216,7 @@
 #define HAVE_SYS_PARAM_H 1
 
 /* Define to 1 if you have the <sys/resource.h> header file. */
-#define HAVE_SYS_RESOURCE_H 1
+/* HAVE_SYS_RESOURCE_H defined in Bazel */
 
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #define HAVE_SYS_STAT_H 1
Index: utils/bazel/llvm-project-overlay/llvm/config.bzl
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/config.bzl
+++ utils/bazel/llvm-project-overlay/llvm/config.bzl
@@ -27,6 +27,10 @@
     "LLVM_ENABLE_THREADS=1",
     "HAVE_SYSEXITS_H=1",
     "HAVE_UNISTD_H=1",
+    "HAVE_PTHREAD_H=1",
+    "HAVE_SYS_RESOURCE_H=1",
+    "CLANG_HAVE_RLIMITS=1",
+    "HAVE_SETENV=1",
     "HAVE_STRERROR_R=1",
     "HAVE_LIBPTHREAD=1",
     "HAVE_PTHREAD_GETNAME_NP=1",
@@ -56,8 +60,9 @@
 
 win32_defines = [
     # MSVC specific
-    "stricmp=_stricmp",
-    "strdup=_strdup",
+    #"stricmp=_stricmp",
+    #"strdup=_strdup",
+    "CINDEX_NO_EXPORTS",
 
     # LLVM features
     r'LTDL_SHLIB_EXT=\".dll\"',
Index: utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
@@ -3096,7 +3096,9 @@
     name = "llvm-mca",
     srcs = glob([
         "tools/llvm-mca/*.cpp",
+        "tools/llvm-mca/*.h",
         "tools/llvm-mca/Views/*.cpp",
+        "tools/llvm-mca/Views/*.h",
     ]),
     copts = llvm_copts,
     stamp = 0,
Index: utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
===================================================================
--- utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
+++ utils/bazel/llvm-project-overlay/clang/include/clang/Config/config.h
@@ -75,7 +75,7 @@
 /* #undef CLANG_HAVE_LIBXML */
 
 /* Define if we have sys/resource.h (rlimits) */
-#define CLANG_HAVE_RLIMITS 1
+/* #undef CLANG_HAVE_RLIMITS */
 
 /* The LLVM product name and version */
 #define BACKEND_PACKAGE_STRING "LLVM 12.0.0git"
Index: utils/bazel/llvm-project-overlay/clang/BUILD.bazel
===================================================================
--- utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -1332,6 +1332,10 @@
         "//llvm:Target",
         "//llvm:config",
     ],
+    linkopts = select({
+        "@bazel_tools//src/conditions:windows": ["/DEFAULTLIB:version.lib"],
+        "//conditions:default": [],
+    }),
 )
 
 gentbl(
@@ -1796,9 +1800,10 @@
         "tools/c-index-test/c-index-test.c",
         "tools/c-index-test/core_main.cpp",
     ],
-    copts = [
-        "-Wno-uninitialized",
-    ],
+    copts = select({
+        "@bazel_tools//src/conditions:windows": [],
+        "//conditions:default": ["-Wno-uninitialized"],
+    }),
     stamp = 0,
     deps = [
         ":ast",
Index: clang/unittests/libclang/TestUtils.h
===================================================================
--- clang/unittests/libclang/TestUtils.h
+++ clang/unittests/libclang/TestUtils.h
@@ -71,7 +71,7 @@
     UnsavedFiles.push_back({
         it.first->first->c_str(),   // filename
         it.first->second->c_str(),  // contents
-        it.first->second->size()    // length
+        static_cast<unsigned long>(it.first->second->size())    // length
     });
   }
   template<typename F>
@@ -91,4 +91,4 @@
   }
 };
 
-#endif // LLVM_CLANG_TEST_TESTUTILS_H
\ No newline at end of file
+#endif // LLVM_CLANG_TEST_TESTUTILS_H
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D112353: [ba... Yuanfang Chen via Phabricator via cfe-commits

Reply via email to