[libcxx] r226040 - Refactor configure_compile_flags. NFC

Jonathan Roelofs jonathan at codesourcery.com
Wed Jan 14 13:02:14 PST 2015


Author: jroelofs
Date: Wed Jan 14 15:02:14 2015
New Revision: 226040

URL: http://llvm.org/viewvc/llvm-project?rev=226040&view=rev
Log:
Refactor configure_compile_flags. NFC

Modified:
    libcxx/trunk/test/libcxx/test/config.py

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=226040&r1=226039&r2=226040&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Wed Jan 14 15:02:14 2015
@@ -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')





More information about the cfe-commits mailing list