summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorJonathan Roelofs <jonathan@codesourcery.com>2015-01-14 21:02:14 +0000
committerJonathan Roelofs <jonathan@codesourcery.com>2015-01-14 21:02:14 +0000
commitda5a97594a1e2887e1df7f17510dac0d66e5b8ce (patch)
tree9724fa4da6ef52d224507eade787ef1ef7356045 /libcxx
parent4d2857321d0c8f05ba2ef0b1ebe90728a3d3fdce (diff)
downloadbcm5719-llvm-da5a97594a1e2887e1df7f17510dac0d66e5b8ce.tar.gz
bcm5719-llvm-da5a97594a1e2887e1df7f17510dac0d66e5b8ce.zip
Refactor configure_compile_flags. NFC
llvm-svn: 226040
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/test/libcxx/test/config.py58
1 files changed, 36 insertions, 22 deletions
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py
index d497c2d5461..b6897acb839 100644
--- a/libcxx/test/libcxx/test/config.py
+++ b/libcxx/test/libcxx/test/config.py
@@ -268,28 +268,14 @@ class Configuration(object):
self.config.available_features.add(std)
# Configure include paths
self.compile_flags += ['-nostdinc++']
- self.compile_flags += ['-I' + self.src_root + '/test/support']
- libcxx_headers = self.get_lit_conf('libcxx_headers',
- self.src_root + '/include')
- if not os.path.isdir(libcxx_headers):
- self.lit_config.fatal("libcxx_headers='%s' is not a directory."
- % libcxx_headers)
- self.compile_flags += ['-I' + libcxx_headers]
+ self.configure_compile_flags_header_includes()
if sys.platform.startswith('linux'):
self.compile_flags += ['-D__STDC_FORMAT_MACROS',
'-D__STDC_LIMIT_MACROS',
'-D__STDC_CONSTANT_MACROS']
# Configure feature flags.
- enable_exceptions = self.get_lit_bool('enable_exceptions', True)
- if enable_exceptions:
- self.config.available_features.add('exceptions')
- else:
- self.compile_flags += ['-fno-exceptions']
- enable_rtti = self.get_lit_bool('enable_rtti', True)
- if enable_rtti:
- self.config.available_features.add('rtti')
- else:
- self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
+ self.configure_compile_flags_exceptions()
+ self.configure_compile_flags_rtti()
enable_32bit = self.get_lit_bool('enable_32bit', False)
if enable_32bit:
self.compile_flags += ['-m32']
@@ -298,12 +284,9 @@ class Configuration(object):
enable_monotonic_clock = self.get_lit_bool('enable_monotonic_clock',
True)
if not enable_threads:
- self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
- self.config.available_features.add('libcpp-has-no-threads')
+ self.configure_compile_flags_no_threads()
if not enable_monotonic_clock:
- self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
- self.config.available_features.add(
- 'libcpp-has-no-monotonic-clock')
+ self.configure_compile_flags_no_monotonic_clock()
elif not enable_monotonic_clock:
self.lit_config.fatal('enable_monotonic_clock cannot be false when'
' enable_threads is true.')
@@ -313,6 +296,37 @@ class Configuration(object):
compile_flags_str = self.get_lit_conf('compile_flags', '')
self.compile_flags += shlex.split(compile_flags_str)
+ def configure_compile_flags_header_includes(self):
+ self.compile_flags += ['-I' + self.src_root + '/test/support']
+ libcxx_headers = self.get_lit_conf('libcxx_headers',
+ self.src_root + '/include')
+ if not os.path.isdir(libcxx_headers):
+ self.lit_config.fatal("libcxx_headers='%s' is not a directory."
+ % libcxx_headers)
+ self.compile_flags += ['-I' + libcxx_headers]
+
+ def configure_compile_flags_exceptions(self):
+ enable_exceptions = self.get_lit_bool('enable_exceptions', True)
+ if enable_exceptions:
+ self.config.available_features.add('exceptions')
+ else:
+ self.compile_flags += ['-fno-exceptions']
+
+ def configure_compile_flags_rtti(self):
+ enable_rtti = self.get_lit_bool('enable_rtti', True)
+ if enable_rtti:
+ self.config.available_features.add('rtti')
+ else:
+ self.compile_flags += ['-fno-rtti', '-D_LIBCPP_NO_RTTI']
+
+ def configure_compile_flags_no_threads(self):
+ self.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
+ self.config.available_features.add('libcpp-has-no-threads')
+
+ def configure_compile_flags_no_monotonic_clock(self):
+ self.compile_flags += ['-D_LIBCPP_HAS_NO_MONOTONIC_CLOCK']
+ self.config.available_features.add('libcpp-has-no-monotonic-clock')
+
def configure_link_flags(self):
self.link_flags += ['-nodefaultlibs']
libcxx_library = self.get_lit_conf('libcxx_library')
OpenPOWER on IntegriCloud