forked from OSchip/llvm-project
Add compiler flag test support to LIT. Fix new/delete tests on apple-clang.
llvm-svn: 237700
This commit is contained in:
parent
a00932bddb
commit
deb3033cd2
|
@ -137,3 +137,13 @@ class CXXCompiler(object):
|
|||
def getTriple(self):
|
||||
cmd = [self.path] + self.flags + ['-dumpmachine']
|
||||
return lit.util.capture(cmd).strip()
|
||||
|
||||
def hasCompileFlag(self, flag):
|
||||
flags = [flag]
|
||||
# Add -Werror to ensure that an unrecognized flag causes a non-zero
|
||||
# exit code. -Werror is supported on all known compiler types.
|
||||
if self.type is not None:
|
||||
flags += ['-Werror']
|
||||
cmd, out, err, rc = self.compile(os.devnull, out=os.devnull,
|
||||
flags=flags)
|
||||
return rc == 0
|
||||
|
|
|
@ -325,6 +325,11 @@ class Configuration(object):
|
|||
if self.long_tests:
|
||||
self.config.available_features.add('long_tests')
|
||||
|
||||
# Run a compile test for the -fsized-deallocation flag. This is needed
|
||||
# in test/std/language.support/support.dynamic/new.delete
|
||||
if self.cxx.hasCompileFlag('-fsized-deallocation'):
|
||||
self.config.available_features.add('fsized-deallocation')
|
||||
|
||||
def configure_compile_flags(self):
|
||||
no_default_flags = self.get_lit_bool('no_default_flags', False)
|
||||
if not no_default_flags:
|
||||
|
@ -530,7 +535,15 @@ class Configuration(object):
|
|||
if use_color != '':
|
||||
self.lit_config.fatal('Invalid value for color_diagnostics "%s".'
|
||||
% use_color)
|
||||
self.cxx.flags += ['-fdiagnostics-color=always']
|
||||
color_flag = '-fdiagnostics-color=always'
|
||||
# Check if the compiler support the color diagnostics flag. Issue a
|
||||
# warning if it does not since color diagnostics have been requested.
|
||||
if not self.cxx.hasCompileFlag(color_flag):
|
||||
self.lit_config.warning(
|
||||
'color diagnostics have been requested but are not supported '
|
||||
'by the compiler')
|
||||
else:
|
||||
self.cxx.flags += [color_flag]
|
||||
|
||||
def configure_debug_mode(self):
|
||||
debug_level = self.get_lit_conf('debug_level', None)
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
|
||||
// UNSUPPORTED: sanitizer-new-delete
|
||||
|
||||
// NOTE: -fsized-deallocation was only added in clang 3.7
|
||||
// XFAIL: clang-3.4, clang-3.5, clang-3.6
|
||||
|
||||
// NOTE: -fsized-deallocation was only added to GCC in 5.1.
|
||||
// XFAIL: gcc-4.7, gcc-4.8, gcc-4.9
|
||||
// NOTE: Require that the compiler supports the -fsized-deallocation flag.
|
||||
// REQUIRES: fsized-deallocation
|
||||
|
||||
// RUN: %build -fsized-deallocation
|
||||
// RUN: %run
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
|
||||
// UNSUPPORTED: sanitizer-new-delete
|
||||
|
||||
// NOTE: -fsized-deallocation was only added in clang 3.7
|
||||
// XFAIL: clang-3.4, clang-3.5, clang-3.6
|
||||
|
||||
// NOTE: -fsized-deallocation was only added to GCC in 5.1.
|
||||
// XFAIL: gcc-4.7, gcc-4.8, gcc-4.9
|
||||
// NOTE: Require that the compiler supports the -fsized-deallocation flag.
|
||||
// REQUIRES: fsized-deallocation
|
||||
|
||||
// RUN: %build -fsized-deallocation
|
||||
// RUN: %run
|
||||
|
|
Loading…
Reference in New Issue