clang: add 'version_argument', remove redundant method (#17071)
This commit is contained in:
@@ -50,6 +50,8 @@ class Clang(Compiler):
|
||||
# Subclasses use possible names of Fortran 90 compiler
|
||||
fc_names = ['flang', 'gfortran', 'xlf90_r']
|
||||
|
||||
version_argument = '--version'
|
||||
|
||||
@property
|
||||
def debug_flags(self):
|
||||
return ['-gcodeview', '-gdwarf-2', '-gdwarf-3', '-gdwarf-4',
|
||||
@@ -201,26 +203,6 @@ def fc_pic_flag(self):
|
||||
|
||||
required_libs = ['libclang']
|
||||
|
||||
@classmethod
|
||||
@llnl.util.lang.memoized
|
||||
def default_version(cls, comp):
|
||||
"""The ``--version`` option works for clang compilers.
|
||||
On most platforms, output looks like this::
|
||||
|
||||
clang version 3.1 (trunk 149096)
|
||||
Target: x86_64-unknown-linux-gnu
|
||||
Thread model: posix
|
||||
|
||||
On macOS, it looks like this::
|
||||
|
||||
Apple LLVM version 7.0.2 (clang-700.1.81)
|
||||
Target: x86_64-apple-darwin15.2.0
|
||||
Thread model: posix
|
||||
"""
|
||||
compiler = Executable(comp)
|
||||
output = compiler('--version', output=str, error=str)
|
||||
return cls.extract_version_from_output(output)
|
||||
|
||||
@classmethod
|
||||
@llnl.util.lang.memoized
|
||||
def extract_version_from_output(cls, output):
|
||||
|
@@ -389,6 +389,7 @@ def test_clang_flags():
|
||||
supported_flag_test("fc_pic_flag", "-fPIC", "clang@2.0.0-apple")
|
||||
|
||||
# non-Apple Clang.
|
||||
supported_flag_test("version_argument", "--version", "clang@foo.bar")
|
||||
supported_flag_test("openmp_flag", "-fopenmp", "clang@3.3")
|
||||
unsupported_flag_test("cxx11_flag", "clang@3.2")
|
||||
supported_flag_test("cxx11_flag", "-std=c++11", "clang@3.3")
|
||||
|
Reference in New Issue
Block a user