llvm.org GIT mirror llvm / 0427957
check-llvm: Ask llvm-config about assertion mode, instead of llc. Add --assertion-mode to llvm-config. It emits ON or OFF according to NDEBUG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196329 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 5 years ago
3 changed file(s) with 15 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1414 # Set the depends list as a variable so that it can grow conditionally.
1515 # NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
1616 set(LLVM_TEST_DEPENDS
17 llvm-config
1718 UnitTests
1819 BugpointPasses
1920 LLVMHello
304304 if config.host_triple == config.target_triple:
305305 config.available_features.add("native")
306306
307 # llc knows whether he is compiled with -DNDEBUG.
307 # Ask llvm-config about assertion mode.
308308 import subprocess
309309 try:
310 llc_cmd = subprocess.Popen([os.path.join(llvm_tools_dir, 'llc'), '-version'],
311 stdout = subprocess.PIPE)
310 llvm_config_cmd = subprocess.Popen(
311 [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],
312 stdout = subprocess.PIPE)
312313 except OSError:
313 print("Could not find llc in " + llvm_tools_dir)
314 print("Could not find llvm-config in " + llvm_tools_dir)
314315 exit(42)
315316
316 if re.search(r'with assertions', llc_cmd.stdout.read().decode('ascii')):
317 if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):
317318 config.available_features.add('asserts')
318 llc_cmd.wait()
319 llvm_config_cmd.wait()
319320
320321 if 'darwin' == sys.platform:
321322 try:
153153 --targets-built List of all targets currently built.\n\
154154 --host-target Target triple used to configure LLVM.\n\
155155 --build-mode Print build mode of LLVM tree (e.g. Debug or Release).\n\
156 --assertion-mode Print assertion mode of LLVM tree (ON or OFF).\n\
156157 Typical components:\n\
157158 all All LLVM libraries (default).\n\
158159 engine Either a native JIT or a bitcode interpreter.\n";
305306 build_mode = CMAKE_CFG_INTDIR;
306307 #endif
307308 OS << build_mode << '\n';
309 } else if (Arg == "--assertion-mode") {
310 #if defined(NDEBUG)
311 OS << "OFF\n";
312 #else
313 OS << "ON\n";
314 #endif
308315 } else if (Arg == "--obj-root") {
309316 OS << LLVM_OBJ_ROOT << '\n';
310317 } else if (Arg == "--src-root") {