mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-11 18:42:01 +00:00
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
This commit is contained in:
parent
e0c0a71531
commit
042795734d
@ -15,6 +15,7 @@ endif()
|
|||||||
# Set the depends list as a variable so that it can grow conditionally.
|
# Set the depends list as a variable so that it can grow conditionally.
|
||||||
# NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
|
# NOTE: Sync the substitutions in test/lit.cfg when adding to this list.
|
||||||
set(LLVM_TEST_DEPENDS
|
set(LLVM_TEST_DEPENDS
|
||||||
|
llvm-config
|
||||||
UnitTests
|
UnitTests
|
||||||
BugpointPasses
|
BugpointPasses
|
||||||
LLVMHello
|
LLVMHello
|
||||||
|
13
test/lit.cfg
13
test/lit.cfg
@ -305,18 +305,19 @@ if config.have_zlib == "1":
|
|||||||
if config.host_triple == config.target_triple:
|
if config.host_triple == config.target_triple:
|
||||||
config.available_features.add("native")
|
config.available_features.add("native")
|
||||||
|
|
||||||
# llc knows whether he is compiled with -DNDEBUG.
|
# Ask llvm-config about assertion mode.
|
||||||
import subprocess
|
import subprocess
|
||||||
try:
|
try:
|
||||||
llc_cmd = subprocess.Popen([os.path.join(llvm_tools_dir, 'llc'), '-version'],
|
llvm_config_cmd = subprocess.Popen(
|
||||||
stdout = subprocess.PIPE)
|
[os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],
|
||||||
|
stdout = subprocess.PIPE)
|
||||||
except OSError:
|
except OSError:
|
||||||
print("Could not find llc in " + llvm_tools_dir)
|
print("Could not find llvm-config in " + llvm_tools_dir)
|
||||||
exit(42)
|
exit(42)
|
||||||
|
|
||||||
if re.search(r'with assertions', llc_cmd.stdout.read().decode('ascii')):
|
if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):
|
||||||
config.available_features.add('asserts')
|
config.available_features.add('asserts')
|
||||||
llc_cmd.wait()
|
llvm_config_cmd.wait()
|
||||||
|
|
||||||
if 'darwin' == sys.platform:
|
if 'darwin' == sys.platform:
|
||||||
try:
|
try:
|
||||||
|
@ -154,6 +154,7 @@ Options:\n\
|
|||||||
--targets-built List of all targets currently built.\n\
|
--targets-built List of all targets currently built.\n\
|
||||||
--host-target Target triple used to configure LLVM.\n\
|
--host-target Target triple used to configure LLVM.\n\
|
||||||
--build-mode Print build mode of LLVM tree (e.g. Debug or Release).\n\
|
--build-mode Print build mode of LLVM tree (e.g. Debug or Release).\n\
|
||||||
|
--assertion-mode Print assertion mode of LLVM tree (ON or OFF).\n\
|
||||||
Typical components:\n\
|
Typical components:\n\
|
||||||
all All LLVM libraries (default).\n\
|
all All LLVM libraries (default).\n\
|
||||||
engine Either a native JIT or a bitcode interpreter.\n";
|
engine Either a native JIT or a bitcode interpreter.\n";
|
||||||
@ -306,6 +307,12 @@ int main(int argc, char **argv) {
|
|||||||
build_mode = CMAKE_CFG_INTDIR;
|
build_mode = CMAKE_CFG_INTDIR;
|
||||||
#endif
|
#endif
|
||||||
OS << build_mode << '\n';
|
OS << build_mode << '\n';
|
||||||
|
} else if (Arg == "--assertion-mode") {
|
||||||
|
#if defined(NDEBUG)
|
||||||
|
OS << "OFF\n";
|
||||||
|
#else
|
||||||
|
OS << "ON\n";
|
||||||
|
#endif
|
||||||
} else if (Arg == "--obj-root") {
|
} else if (Arg == "--obj-root") {
|
||||||
OS << LLVM_OBJ_ROOT << '\n';
|
OS << LLVM_OBJ_ROOT << '\n';
|
||||||
} else if (Arg == "--src-root") {
|
} else if (Arg == "--src-root") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user