|
|
@ -2085,18 +2085,12 @@ class ClangCompiler(): |
|
|
|
def get_pch_suffix(self): |
|
|
|
def get_pch_suffix(self): |
|
|
|
return 'pch' |
|
|
|
return 'pch' |
|
|
|
|
|
|
|
|
|
|
|
def can_compile(self, filename): |
|
|
|
|
|
|
|
return super().can_compile(filename) or filename.split('.')[-1].lower() == 's' # Clang can do asm, too. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_pch_use_args(self, pch_dir, header): |
|
|
|
def get_pch_use_args(self, pch_dir, header): |
|
|
|
# Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136 |
|
|
|
# Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136 |
|
|
|
# This flag is internal to Clang (or at least not documented on the man page) |
|
|
|
# This flag is internal to Clang (or at least not documented on the man page) |
|
|
|
# so it might change semantics at any time. |
|
|
|
# so it might change semantics at any time. |
|
|
|
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))] |
|
|
|
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))] |
|
|
|
|
|
|
|
|
|
|
|
def has_argument(self, arg, env): |
|
|
|
|
|
|
|
return super().has_argument(['-Werror=unknown-warning-option', arg], env) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ClangObjCCompiler(GnuObjCCompiler): |
|
|
|
class ClangObjCCompiler(GnuObjCCompiler): |
|
|
|
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): |
|
|
|
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): |
|
|
|
super().__init__(exelist, version, is_cross, exe_wrapper) |
|
|
|
super().__init__(exelist, version, is_cross, exe_wrapper) |
|
|
@ -2140,34 +2134,20 @@ class ClangCCompiler(ClangCompiler, CCompiler): |
|
|
|
def get_option_link_args(self, options): |
|
|
|
def get_option_link_args(self, options): |
|
|
|
return [] |
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def has_argument(self, arg, env): |
|
|
|
|
|
|
|
return super().has_argument(['-Werror=unknown-warning-option', arg], env) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def can_compile(self, filename): |
|
|
|
|
|
|
|
return super().can_compile(filename) or filename.split('.')[-1].lower() == 's' # Clang can do asm, too. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ClangCPPCompiler(CPPCompiler): |
|
|
|
class ClangCPPCompiler(ClangCompiler, CPPCompiler): |
|
|
|
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): |
|
|
|
def __init__(self, exelist, version, cltype, is_cross, exe_wrapper=None): |
|
|
|
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) |
|
|
|
CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) |
|
|
|
self.id = 'clang' |
|
|
|
ClangCompiler.__init__(self, cltype) |
|
|
|
self.warn_args = {'1': ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'], |
|
|
|
self.warn_args = {'1': ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor'], |
|
|
|
'2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'], |
|
|
|
'2': ['-Wall', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor'], |
|
|
|
'3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']} |
|
|
|
'3': ['-Wall', '-Wpedantic', '-Wextra', '-Winvalid-pch', '-Wnon-virtual-dtor']} |
|
|
|
self.clang_type = cltype |
|
|
|
|
|
|
|
self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage'] |
|
|
|
|
|
|
|
if self.clang_type != CLANG_OSX: |
|
|
|
|
|
|
|
self.base_options.append('b_lundef') |
|
|
|
|
|
|
|
self.base_options.append('b_asneeded') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_buildtype_args(self, buildtype): |
|
|
|
|
|
|
|
return gnulike_buildtype_args[buildtype] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_buildtype_linker_args(self, buildtype): |
|
|
|
|
|
|
|
return gnulike_buildtype_linker_args[buildtype] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_pch_suffix(self): |
|
|
|
|
|
|
|
return 'pch' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_pch_use_args(self, pch_dir, header): |
|
|
|
|
|
|
|
# Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136 |
|
|
|
|
|
|
|
# This flag is internal to Clang (or at least not documented on the man page) |
|
|
|
|
|
|
|
# so it might change semantics at any time. |
|
|
|
|
|
|
|
return ['-include-pch', os.path.join (pch_dir, self.get_pch_name (header))] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_options(self): |
|
|
|
def get_options(self): |
|
|
|
return {'cpp_std' : coredata.UserComboOption('cpp_std', 'C++ language standard to use', |
|
|
|
return {'cpp_std' : coredata.UserComboOption('cpp_std', 'C++ language standard to use', |
|
|
@ -2187,6 +2167,9 @@ class ClangCPPCompiler(CPPCompiler): |
|
|
|
def has_argument(self, arg, env): |
|
|
|
def has_argument(self, arg, env): |
|
|
|
return super().has_argument(['-Werror=unknown-warning-option', arg], env) |
|
|
|
return super().has_argument(['-Werror=unknown-warning-option', arg], env) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def can_compile(self, filename): |
|
|
|
|
|
|
|
return super().can_compile(filename) or filename.split('.')[-1].lower() == 's' # Clang can do asm, too. |
|
|
|
|
|
|
|
|
|
|
|
class FortranCompiler(Compiler): |
|
|
|
class FortranCompiler(Compiler): |
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
def __init__(self, exelist, version, is_cross, exe_wrapper=None): |
|
|
|
super().__init__(exelist, version) |
|
|
|
super().__init__(exelist, version) |
|
|
|