本文整理汇总了Python中libcxx.compiler.CXXCompiler.getTriple方法的典型用法代码示例。如果您正苦于以下问题:Python CXXCompiler.getTriple方法的具体用法?Python CXXCompiler.getTriple怎么用?Python CXXCompiler.getTriple使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libcxx.compiler.CXXCompiler
的用法示例。
在下文中一共展示了CXXCompiler.getTriple方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Configuration
# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import getTriple [as 别名]
#.........这里部分代码省略.........
if self.target_info.platform() == 'darwin':
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Thread':
self.cxx.flags += ['-fsanitize=thread']
self.config.available_features.add('tsan')
self.config.available_features.add('sanitizer-new-delete')
else:
self.lit_config.fatal('unsupported value for '
'use_sanitizer: {0}'.format(san))
san_lib = self.get_lit_conf('sanitizer_library')
if san_lib:
self.cxx.link_flags += [
san_lib, '-Wl,-rpath,%s' % os.path.dirname(san_lib)]
def configure_coverage(self):
self.generate_coverage = self.get_lit_bool('generate_coverage', False)
if self.generate_coverage:
self.cxx.flags += ['-g', '--coverage']
self.cxx.compile_flags += ['-O0']
def configure_substitutions(self):
sub = self.config.substitutions
# Configure compiler substitions
sub.append(('%cxx', self.cxx.path))
# Configure flags substitutions
flags_str = ' '.join(self.cxx.flags)
compile_flags_str = ' '.join(self.cxx.compile_flags)
link_flags_str = ' '.join(self.cxx.link_flags)
all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str)
sub.append(('%flags', flags_str))
sub.append(('%compile_flags', compile_flags_str))
sub.append(('%link_flags', link_flags_str))
sub.append(('%all_flags', all_flags))
# Add compile and link shortcuts
compile_str = (self.cxx.path + ' -o %t.o %s -c ' + flags_str
+ compile_flags_str)
link_str = (self.cxx.path + ' -o %t.exe %t.o ' + flags_str
+ link_flags_str)
assert type(link_str) is str
build_str = self.cxx.path + ' -o %t.exe %s ' + all_flags
sub.append(('%compile', compile_str))
sub.append(('%link', link_str))
sub.append(('%build', build_str))
# Configure exec prefix substitutions.
exec_env_str = 'env ' if len(self.env) != 0 else ''
for k, v in self.env.items():
exec_env_str += ' %s=%s' % (k, v)
# Configure run env substitution.
exec_str = ''
if self.lit_config.useValgrind:
exec_str = ' '.join(self.lit_config.valgrindArgs) + exec_env_str
sub.append(('%exec', exec_str))
# Configure run shortcut
sub.append(('%run', exec_str + ' %t.exe'))
# Configure not program substitions
not_py = os.path.join(self.libcxx_src_root, 'utils', 'not', 'not.py')
not_str = '%s %s' % (sys.executable, not_py)
sub.append(('not', not_str))
def configure_triple(self):
# Get or infer the target triple.
self.config.target_triple = self.get_lit_conf('target_triple')
self.use_target = bool(self.config.target_triple)
# If no target triple was given, try to infer it from the compiler
# under test.
if not self.use_target:
target_triple = self.cxx.getTriple()
# Drop sub-major version components from the triple, because the
# current XFAIL handling expects exact matches for feature checks.
# Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14
# The 5th group handles triples greater than 3 parts
# (ex x86_64-pc-linux-gnu).
target_triple = re.sub(r'([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)',
r'\1-\2-\3\5', target_triple)
# linux-gnu is needed in the triple to properly identify linuxes
# that use GLIBC. Handle redhat and opensuse triples as special
# cases and append the missing `-gnu` portion.
if (target_triple.endswith('redhat-linux') or
target_triple.endswith('suse-linux')):
target_triple += '-gnu'
self.config.target_triple = target_triple
self.lit_config.note(
"inferred target_triple as: %r" % self.config.target_triple)
def configure_env(self):
if self.target_info.platform() == 'darwin':
library_paths = []
# Configure the library path for libc++
libcxx_library = self.get_lit_conf('libcxx_library')
if self.use_system_cxx_lib:
pass
elif libcxx_library:
library_paths += [os.path.dirname(libcxx_library)]
elif self.cxx_library_root:
library_paths += [self.cxx_library_root]
# Configure the abi library path
if self.abi_library_root:
library_paths += [self.abi_library_root]
if library_paths:
self.env['DYLD_LIBRARY_PATH'] = ':'.join(library_paths)
示例2: Configuration
# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import getTriple [as 别名]
#.........这里部分代码省略.........
self.env["MSAN_SYMBOLIZER_PATH"] = llvm_symbolizer
self.config.available_features.add("msan")
self.config.available_features.add("sanitizer-new-delete")
elif san == "Undefined":
self.cxx.flags += ["-fsanitize=undefined", "-fno-sanitize=vptr,function", "-fno-sanitize-recover"]
self.cxx.compile_flags += ["-O3"]
self.config.available_features.add("ubsan")
if self.target_info.platform() == "darwin":
self.config.available_features.add("sanitizer-new-delete")
elif san == "Thread":
self.cxx.flags += ["-fsanitize=thread"]
self.config.available_features.add("tsan")
self.config.available_features.add("sanitizer-new-delete")
else:
self.lit_config.fatal("unsupported value for " "use_sanitizer: {0}".format(san))
san_lib = self.get_lit_conf("sanitizer_library")
if san_lib:
self.cxx.link_flags += [san_lib, "-Wl,-rpath,%s" % os.path.dirname(san_lib)]
def configure_coverage(self):
self.generate_coverage = self.get_lit_bool("generate_coverage", False)
if self.generate_coverage:
self.cxx.flags += ["-g", "--coverage"]
self.cxx.compile_flags += ["-O0"]
def configure_substitutions(self):
sub = self.config.substitutions
# Configure compiler substitions
sub.append(("%cxx", self.cxx.path))
# Configure flags substitutions
flags_str = " ".join(self.cxx.flags)
compile_flags_str = " ".join(self.cxx.compile_flags)
link_flags_str = " ".join(self.cxx.link_flags)
all_flags = "%s %s %s" % (flags_str, compile_flags_str, link_flags_str)
sub.append(("%flags", flags_str))
sub.append(("%compile_flags", compile_flags_str))
sub.append(("%link_flags", link_flags_str))
sub.append(("%all_flags", all_flags))
# Add compile and link shortcuts
compile_str = self.cxx.path + " -o %t.o %s -c " + flags_str + compile_flags_str
link_str = self.cxx.path + " -o %t.exe %t.o " + flags_str + link_flags_str
assert type(link_str) is str
build_str = self.cxx.path + " -o %t.exe %s " + all_flags
sub.append(("%compile", compile_str))
sub.append(("%link", link_str))
sub.append(("%build", build_str))
# Configure exec prefix substitutions.
exec_env_str = "env " if len(self.env) != 0 else ""
for k, v in self.env.items():
exec_env_str += " %s=%s" % (k, v)
# Configure run env substitution.
exec_str = ""
if self.lit_config.useValgrind:
exec_str = " ".join(self.lit_config.valgrindArgs) + exec_env_str
sub.append(("%exec", exec_str))
# Configure run shortcut
sub.append(("%run", exec_str + " %t.exe"))
# Configure not program substitions
not_py = os.path.join(self.libcxx_src_root, "utils", "not", "not.py")
not_str = "%s %s" % (sys.executable, not_py)
sub.append(("not", not_str))
def configure_triple(self):
# Get or infer the target triple.
self.config.target_triple = self.get_lit_conf("target_triple")
self.use_target = bool(self.config.target_triple)
# If no target triple was given, try to infer it from the compiler
# under test.
if not self.use_target:
target_triple = self.cxx.getTriple()
# Drop sub-major version components from the triple, because the
# current XFAIL handling expects exact matches for feature checks.
# Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14
# The 5th group handles triples greater than 3 parts
# (ex x86_64-pc-linux-gnu).
target_triple = re.sub(r"([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)", r"\1-\2-\3\5", target_triple)
# linux-gnu is needed in the triple to properly identify linuxes
# that use GLIBC. Handle redhat and opensuse triples as special
# cases and append the missing `-gnu` portion.
if target_triple.endswith("redhat-linux") or target_triple.endswith("suse-linux"):
target_triple += "-gnu"
self.config.target_triple = target_triple
self.lit_config.note("inferred target_triple as: %r" % self.config.target_triple)
def configure_env(self):
if self.target_info.platform() == "darwin":
library_paths = []
# Configure the library path for libc++
libcxx_library = self.get_lit_conf("libcxx_library")
if self.use_system_cxx_lib:
pass
elif libcxx_library:
library_paths += [os.path.dirname(libcxx_library)]
elif self.cxx_library_root:
library_paths += [self.cxx_library_root]
# Configure the abi library path
if self.abi_library_root:
library_paths += [self.abi_library_root]
if library_paths:
self.env["DYLD_LIBRARY_PATH"] = ":".join(library_paths)
示例3: Configuration
# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import getTriple [as 别名]
#.........这里部分代码省略.........
return
self.config.available_features.add('modules-support')
module_cache = os.path.join(self.config.test_exec_root,
'modules.cache')
module_cache = os.path.realpath(module_cache)
if os.path.isdir(module_cache):
shutil.rmtree(module_cache)
os.makedirs(module_cache)
self.cxx.modules_flags = modules_flags + \
['-fmodules-cache-path=' + module_cache]
if enable_modules:
self.config.available_features.add('-fmodules')
self.cxx.useModules()
def configure_substitutions(self):
sub = self.config.substitutions
# Configure compiler substitutions
sub.append(('%cxx', self.cxx.path))
# Configure flags substitutions
flags_str = ' '.join(self.cxx.flags)
compile_flags_str = ' '.join(self.cxx.compile_flags)
link_flags_str = ' '.join(self.cxx.link_flags)
all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str)
sub.append(('%flags', flags_str))
sub.append(('%compile_flags', compile_flags_str))
sub.append(('%link_flags', link_flags_str))
sub.append(('%all_flags', all_flags))
if self.cxx.isVerifySupported():
verify_str = ' ' + ' '.join(self.cxx.verify_flags) + ' '
sub.append(('%verify', verify_str))
# Add compile and link shortcuts
compile_str = (self.cxx.path + ' -o %t.o %s -c ' + flags_str
+ ' ' + compile_flags_str)
link_str = (self.cxx.path + ' -o %t.exe %t.o ' + flags_str + ' '
+ link_flags_str)
assert type(link_str) is str
build_str = self.cxx.path + ' -o %t.exe %s ' + all_flags
if self.cxx.use_modules:
sub.append(('%compile_module', compile_str))
sub.append(('%build_module', build_str))
elif self.cxx.modules_flags is not None:
modules_str = ' '.join(self.cxx.modules_flags) + ' '
sub.append(('%compile_module', compile_str + ' ' + modules_str))
sub.append(('%build_module', build_str + ' ' + modules_str))
sub.append(('%compile', compile_str))
sub.append(('%link', link_str))
sub.append(('%build', build_str))
# Configure exec prefix substitutions.
exec_env_str = 'env ' if len(self.exec_env) != 0 else ''
for k, v in self.exec_env.items():
exec_env_str += ' %s=%s' % (k, v)
# Configure run env substitution.
exec_str = exec_env_str
if self.lit_config.useValgrind:
exec_str = ' '.join(self.lit_config.valgrindArgs) + exec_env_str
sub.append(('%exec', exec_str))
# Configure run shortcut
sub.append(('%run', exec_str + ' %t.exe'))
# Configure not program substitutions
not_py = os.path.join(self.libcxx_src_root, 'utils', 'not', 'not.py')
not_str = '%s %s ' % (sys.executable, not_py)
sub.append(('not ', not_str))
def configure_triple(self):
# Get or infer the target triple.
self.config.target_triple = self.get_lit_conf('target_triple')
self.use_target = self.get_lit_bool('use_target', False)
if self.use_target and self.config.target_triple:
self.lit_config.warning('use_target is true but no triple is specified')
# If no target triple was given, try to infer it from the compiler
# under test.
if not self.config.target_triple:
target_triple = self.cxx.getTriple()
# Drop sub-major version components from the triple, because the
# current XFAIL handling expects exact matches for feature checks.
# Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14
# The 5th group handles triples greater than 3 parts
# (ex x86_64-pc-linux-gnu).
target_triple = re.sub(r'([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)',
r'\1-\2-\3\5', target_triple)
# linux-gnu is needed in the triple to properly identify linuxes
# that use GLIBC. Handle redhat and opensuse triples as special
# cases and append the missing `-gnu` portion.
if (target_triple.endswith('redhat-linux') or
target_triple.endswith('suse-linux')):
target_triple += '-gnu'
self.config.target_triple = target_triple
self.lit_config.note(
"inferred target_triple as: %r" % self.config.target_triple)
def configure_env(self):
self.target_info.configure_env(self.exec_env)
def add_path(self, dest_env, new_path):
if 'PATH' not in dest_env:
dest_env['PATH'] = new_path
else:
split_char = ';' if self.is_windows else ':'
dest_env['PATH'] = '%s%s%s' % (new_path, split_char,
dest_env['PATH'])
示例4: Configuration
# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import getTriple [as 别名]
#.........这里部分代码省略.........
self.env["ASAN_SYMBOLIZER_PATH"] = llvm_symbolizer
# FIXME: Turn ODR violation back on after PR28391 is resolved
# https://llvm.org/bugs/show_bug.cgi?id=28391
self.env["ASAN_OPTIONS"] = "detect_odr_violation=0"
self.config.available_features.add("asan")
self.config.available_features.add("sanitizer-new-delete")
elif san == "Memory" or san == "MemoryWithOrigins":
self.cxx.flags += ["-fsanitize=memory"]
if san == "MemoryWithOrigins":
self.cxx.compile_flags += ["-fsanitize-memory-track-origins"]
if llvm_symbolizer is not None:
self.env["MSAN_SYMBOLIZER_PATH"] = llvm_symbolizer
self.config.available_features.add("msan")
self.config.available_features.add("sanitizer-new-delete")
elif san == "Undefined":
self.cxx.flags += [
"-fsanitize=undefined",
"-fno-sanitize=vptr,function,float-divide-by-zero",
"-fno-sanitize-recover=all",
]
self.cxx.compile_flags += ["-O2"]
self.env["UBSAN_OPTIONS"] = "print_stacktrace=1"
self.config.available_features.add("ubsan")
elif san == "Thread":
self.cxx.flags += ["-fsanitize=thread"]
self.config.available_features.add("tsan")
self.config.available_features.add("sanitizer-new-delete")
else:
self.lit_config.fatal("unsupported value for " "use_sanitizer: {0}".format(san))
san_lib = self.get_lit_conf("sanitizer_library")
if san_lib:
self.cxx.link_flags += [san_lib, "-Wl,-rpath,%s" % os.path.dirname(san_lib)]
def configure_coverage(self):
self.generate_coverage = self.get_lit_bool("generate_coverage", False)
if self.generate_coverage:
self.cxx.flags += ["-g", "--coverage"]
self.cxx.compile_flags += ["-O0"]
def configure_substitutions(self):
sub = self.config.substitutions
# Configure compiler substitutions
sub.append(("%cxx", self.cxx.path))
# Configure flags substitutions
flags_str = " ".join(self.cxx.flags)
compile_flags_str = " ".join(self.cxx.compile_flags)
link_flags_str = " ".join(self.cxx.link_flags)
all_flags = "%s %s %s" % (flags_str, compile_flags_str, link_flags_str)
sub.append(("%flags", flags_str))
sub.append(("%compile_flags", compile_flags_str))
sub.append(("%link_flags", link_flags_str))
sub.append(("%all_flags", all_flags))
# Add compile and link shortcuts
compile_str = self.cxx.path + " -o %t.o %s -c " + flags_str + compile_flags_str
link_str = self.cxx.path + " -o %t.exe %t.o " + flags_str + link_flags_str
assert type(link_str) is str
build_str = self.cxx.path + " -o %t.exe %s " + all_flags
sub.append(("%compile", compile_str))
sub.append(("%link", link_str))
sub.append(("%build", build_str))
# Configure exec prefix substitutions.
exec_env_str = "env " if len(self.env) != 0 else ""
for k, v in self.env.items():
exec_env_str += " %s=%s" % (k, v)
# Configure run env substitution.
exec_str = exec_env_str
if self.lit_config.useValgrind:
exec_str = " ".join(self.lit_config.valgrindArgs) + exec_env_str
sub.append(("%exec", exec_str))
# Configure run shortcut
sub.append(("%run", exec_str + " %t.exe"))
# Configure not program substitions
not_py = os.path.join(self.libcxx_src_root, "utils", "not", "not.py")
not_str = "%s %s" % (sys.executable, not_py)
sub.append(("not", not_str))
def configure_triple(self):
# Get or infer the target triple.
self.config.target_triple = self.get_lit_conf("target_triple")
self.use_target = bool(self.config.target_triple)
# If no target triple was given, try to infer it from the compiler
# under test.
if not self.use_target:
target_triple = self.cxx.getTriple()
# Drop sub-major version components from the triple, because the
# current XFAIL handling expects exact matches for feature checks.
# Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14
# The 5th group handles triples greater than 3 parts
# (ex x86_64-pc-linux-gnu).
target_triple = re.sub(r"([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)", r"\1-\2-\3\5", target_triple)
# linux-gnu is needed in the triple to properly identify linuxes
# that use GLIBC. Handle redhat and opensuse triples as special
# cases and append the missing `-gnu` portion.
if target_triple.endswith("redhat-linux") or target_triple.endswith("suse-linux"):
target_triple += "-gnu"
self.config.target_triple = target_triple
self.lit_config.note("inferred target_triple as: %r" % self.config.target_triple)
def configure_env(self):
self.target_info.configure_env(self.env)
示例5: Configuration
# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import getTriple [as 别名]
#.........这里部分代码省略.........
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Memory' or san == 'MemoryWithOrigins':
self.cxx.flags += ['-fsanitize=memory']
if san == 'MemoryWithOrigins':
self.cxx.compile_flags += [
'-fsanitize-memory-track-origins']
if llvm_symbolizer is not None:
self.env['MSAN_SYMBOLIZER_PATH'] = llvm_symbolizer
self.config.available_features.add('msan')
self.config.available_features.add('sanitizer-new-delete')
elif san == 'Undefined':
self.cxx.flags += ['-fsanitize=undefined',
'-fno-sanitize=vptr,function',
'-fno-sanitize-recover']
self.cxx.compile_flags += ['-O3']
self.config.available_features.add('ubsan')
elif san == 'Thread':
self.cxx.flags += ['-fsanitize=thread']
self.config.available_features.add('tsan')
self.config.available_features.add('sanitizer-new-delete')
else:
self.lit_config.fatal('unsupported value for '
'use_sanitizer: {0}'.format(san))
san_lib = self.get_lit_conf('sanitizer_library')
if san_lib:
self.cxx.link_flags += [
san_lib, '-Wl,-rpath,%s' % os.path.dirname(san_lib)]
def configure_coverage(self):
self.generate_coverage = self.get_lit_bool('generate_coverage', False)
if self.generate_coverage:
self.cxx.flags += ['-g', '--coverage']
self.cxx.compile_flags += ['-O0']
def configure_substitutions(self):
sub = self.config.substitutions
# Configure compiler substitions
sub.append(('%cxx', self.cxx.path))
# Configure flags substitutions
flags_str = ' '.join(self.cxx.flags)
compile_flags_str = ' '.join(self.cxx.compile_flags)
link_flags_str = ' '.join(self.cxx.link_flags)
all_flags = '%s %s %s' % (flags_str, compile_flags_str, link_flags_str)
sub.append(('%flags', flags_str))
sub.append(('%compile_flags', compile_flags_str))
sub.append(('%link_flags', link_flags_str))
sub.append(('%all_flags', all_flags))
# Add compile and link shortcuts
compile_str = (self.cxx.path + ' -o %t.o %s -c ' + flags_str
+ compile_flags_str)
link_str = (self.cxx.path + ' -o %t.exe %t.o ' + flags_str
+ link_flags_str)
assert type(link_str) is str
build_str = self.cxx.path + ' -o %t.exe %s ' + all_flags
sub.append(('%compile', compile_str))
sub.append(('%link', link_str))
sub.append(('%build', build_str))
# Configure exec prefix substitutions.
exec_env_str = 'env ' if len(self.env) != 0 else ''
for k, v in self.env.items():
exec_env_str += ' %s=%s' % (k, v)
# Configure run env substitution.
exec_str = ''
if self.lit_config.useValgrind:
exec_str = ' '.join(self.lit_config.valgrindArgs) + exec_env_str
sub.append(('%exec', exec_str))
# Configure run shortcut
sub.append(('%run', exec_str + ' %t.exe'))
# Configure not program substitions
not_py = os.path.join(self.libcxx_src_root, 'utils', 'not', 'not.py')
not_str = '%s %s' % (sys.executable, not_py)
sub.append(('not', not_str))
def configure_triple(self):
# Get or infer the target triple.
self.config.target_triple = self.get_lit_conf('target_triple')
self.use_target = bool(self.config.target_triple)
# If no target triple was given, try to infer it from the compiler
# under test.
if not self.use_target:
target_triple = self.cxx.getTriple()
# Drop sub-major version components from the triple, because the
# current XFAIL handling expects exact matches for feature checks.
# Example: x86_64-apple-darwin14.0.0 -> x86_64-apple-darwin14
# The 5th group handles triples greater than 3 parts
# (ex x86_64-pc-linux-gnu).
target_triple = re.sub(r'([^-]+)-([^-]+)-([^.]+)([^-]*)(.*)',
r'\1-\2-\3\5', target_triple)
# linux-gnu is needed in the triple to properly identify linuxes
# that use GLIBC. Handle redhat and opensuse triples as special
# cases and append the missing `-gnu` portion.
if (target_triple.endswith('redhat-linux') or
target_triple.endswith('suse-linux')):
target_triple += '-gnu'
self.config.target_triple = target_triple
self.lit_config.note(
"inferred target_triple as: %r" % self.config.target_triple)
def configure_env(self):
self.target_info.configure_env(self.env)