[Mlir-commits] [mlir] 3db57d1 - [mlir] Emit errors if global constructors are found within lib/
River Riddle
llvmlistbot at llvm.org
Fri Apr 10 13:05:06 PDT 2020
Author: River Riddle
Date: 2020-04-10T13:04:32-07:00
New Revision: 3db57d14ecf55efd86cd3007dc755d27669e7828
URL: https://github.com/llvm/llvm-project/commit/3db57d14ecf55efd86cd3007dc755d27669e7828
DIFF: https://github.com/llvm/llvm-project/commit/3db57d14ecf55efd86cd3007dc755d27669e7828.diff
LOG: [mlir] Emit errors if global constructors are found within lib/
Summary: This avoids adding any additional global constructors, like cl::opt. There is a temporary exception on IR/, which has a few cl::opts that require a bit of plumbing to remove.
Differential Revision: https://reviews.llvm.org/D77824
Added:
Modified:
mlir/lib/CMakeLists.txt
mlir/lib/IR/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/lib/CMakeLists.txt b/mlir/lib/CMakeLists.txt
index c51e780c20ab..c1392313faa9 100644
--- a/mlir/lib/CMakeLists.txt
+++ b/mlir/lib/CMakeLists.txt
@@ -1,3 +1,6 @@
+# Enable errors for any global constructors.
+add_flag_if_supported("-Werror=global-constructors" WERROR_GLOBAL_CONSTRUCTOR)
+
add_subdirectory(Analysis)
add_subdirectory(Conversion)
add_subdirectory(Dialect)
diff --git a/mlir/lib/IR/CMakeLists.txt b/mlir/lib/IR/CMakeLists.txt
index 64998e4252c3..c5dc2d292f5e 100644
--- a/mlir/lib/IR/CMakeLists.txt
+++ b/mlir/lib/IR/CMakeLists.txt
@@ -1,3 +1,6 @@
+# TODO: Remove the need for global constructors within IR/
+add_flag_if_supported("-Wno-global-constructors" WNO_GLOBAL_CONSTRUCTOR_MLIR_IR)
+
file(GLOB globbed *.c *.cpp)
add_mlir_library(MLIRIR
${globbed}
More information about the Mlir-commits
mailing list