[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
This commit is contained in:
River Riddle 2020-04-10 12:57:18 -07:00
parent ebf22a4935
commit 3db57d14ec
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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}