本文整理汇总了C++中llvm::Triple::str方法的典型用法代码示例。如果您正苦于以下问题:C++ Triple::str方法的具体用法?C++ Triple::str怎么用?C++ Triple::str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::Triple
的用法示例。
在下文中一共展示了Triple::str方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMultiarchTriple
/// \brief Get our best guess at the multiarch triple for a target.
///
/// Debian-based systems are starting to use a multiarch setup where they use
/// a target-triple directory in the library and header search paths.
/// Unfortunately, this triple does not align with the vanilla target triple,
/// so we provide a rough mapping here.
static std::string getMultiarchTriple(const Driver &D,
const llvm::Triple &TargetTriple,
StringRef SysRoot) {
llvm::Triple::EnvironmentType TargetEnvironment =
TargetTriple.getEnvironment();
// For most architectures, just use whatever we have rather than trying to be
// clever.
switch (TargetTriple.getArch()) {
default:
break;
// We use the existence of '/lib/<triple>' as a directory to detect some
// common linux triples that don't quite match the Clang triple for both
// 32-bit and 64-bit targets. Multiarch fixes its install triples to these
// regardless of what the actual target triple is.
case llvm::Triple::arm:
case llvm::Triple::thumb:
if (TargetEnvironment == llvm::Triple::GNUEABIHF) {
if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabihf"))
return "arm-linux-gnueabihf";
} else {
if (D.getVFS().exists(SysRoot + "/lib/arm-linux-gnueabi"))
return "arm-linux-gnueabi";
}
break;
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
if (TargetEnvironment == llvm::Triple::GNUEABIHF) {
if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabihf"))
return "armeb-linux-gnueabihf";
} else {
if (D.getVFS().exists(SysRoot + "/lib/armeb-linux-gnueabi"))
return "armeb-linux-gnueabi";
}
break;
case llvm::Triple::x86:
if (D.getVFS().exists(SysRoot + "/lib/i386-linux-gnu"))
return "i386-linux-gnu";
break;
case llvm::Triple::x86_64:
// We don't want this for x32, otherwise it will match x86_64 libs
if (TargetEnvironment != llvm::Triple::GNUX32 &&
D.getVFS().exists(SysRoot + "/lib/x86_64-linux-gnu"))
return "x86_64-linux-gnu";
break;
case llvm::Triple::aarch64:
if (D.getVFS().exists(SysRoot + "/lib/aarch64-linux-gnu"))
return "aarch64-linux-gnu";
break;
case llvm::Triple::aarch64_be:
if (D.getVFS().exists(SysRoot + "/lib/aarch64_be-linux-gnu"))
return "aarch64_be-linux-gnu";
break;
case llvm::Triple::mips:
if (D.getVFS().exists(SysRoot + "/lib/mips-linux-gnu"))
return "mips-linux-gnu";
break;
case llvm::Triple::mipsel:
if (D.getVFS().exists(SysRoot + "/lib/mipsel-linux-gnu"))
return "mipsel-linux-gnu";
break;
case llvm::Triple::mips64:
if (D.getVFS().exists(SysRoot + "/lib/mips64-linux-gnu"))
return "mips64-linux-gnu";
if (D.getVFS().exists(SysRoot + "/lib/mips64-linux-gnuabi64"))
return "mips64-linux-gnuabi64";
break;
case llvm::Triple::mips64el:
if (D.getVFS().exists(SysRoot + "/lib/mips64el-linux-gnu"))
return "mips64el-linux-gnu";
if (D.getVFS().exists(SysRoot + "/lib/mips64el-linux-gnuabi64"))
return "mips64el-linux-gnuabi64";
break;
case llvm::Triple::ppc:
if (D.getVFS().exists(SysRoot + "/lib/powerpc-linux-gnuspe"))
return "powerpc-linux-gnuspe";
if (D.getVFS().exists(SysRoot + "/lib/powerpc-linux-gnu"))
return "powerpc-linux-gnu";
break;
case llvm::Triple::ppc64:
if (D.getVFS().exists(SysRoot + "/lib/powerpc64-linux-gnu"))
return "powerpc64-linux-gnu";
break;
case llvm::Triple::ppc64le:
if (D.getVFS().exists(SysRoot + "/lib/powerpc64le-linux-gnu"))
return "powerpc64le-linux-gnu";
break;
case llvm::Triple::sparc:
if (D.getVFS().exists(SysRoot + "/lib/sparc-linux-gnu"))
return "sparc-linux-gnu";
break;
case llvm::Triple::sparcv9:
if (D.getVFS().exists(SysRoot + "/lib/sparc64-linux-gnu"))
//.........这里部分代码省略.........
示例2: AddDefaultCIncludePaths
void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
const HeaderSearchOptions &HSOpts) {
llvm::Triple::OSType os = triple.getOS();
if (HSOpts.UseStandardSystemIncludes) {
switch (os) {
case llvm::Triple::CloudABI:
case llvm::Triple::FreeBSD:
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
case llvm::Triple::NaCl:
case llvm::Triple::PS4:
case llvm::Triple::ELFIAMCU:
break;
case llvm::Triple::Win32:
if (triple.getEnvironment() != llvm::Triple::Cygnus)
break;
LLVM_FALLTHROUGH;
default:
// FIXME: temporary hack: hard-coded paths.
AddPath("/usr/local/include", System, false);
break;
}
}
// Builtin includes use #include_next directives and should be positioned
// just prior C include dirs.
if (HSOpts.UseBuiltinIncludes) {
// Ignore the sys root, we *always* look for clang headers relative to
// supplied path.
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "include");
AddUnmappedPath(P, ExternCSystem, false);
}
// All remaining additions are for system include directories, early exit if
// we aren't using them.
if (!HSOpts.UseStandardSystemIncludes)
return;
// Add dirs specified via 'configure --with-c-include-dirs'.
StringRef CIncludeDirs(C_INCLUDE_DIRS);
if (CIncludeDirs != "") {
SmallVector<StringRef, 5> dirs;
CIncludeDirs.split(dirs, ":");
for (StringRef dir : dirs)
AddPath(dir, ExternCSystem, false);
return;
}
switch (os) {
case llvm::Triple::Linux:
case llvm::Triple::Solaris:
llvm_unreachable("Include management is handled in the driver.");
case llvm::Triple::CloudABI: {
// <sysroot>/<triple>/include
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "../../..", triple.str(), "include");
AddPath(P, System, false);
break;
}
case llvm::Triple::Haiku:
AddPath("/boot/system/non-packaged/develop/headers", System, false);
AddPath("/boot/system/develop/headers/os", System, false);
AddPath("/boot/system/develop/headers/os/app", System, false);
AddPath("/boot/system/develop/headers/os/arch", System, false);
AddPath("/boot/system/develop/headers/os/device", System, false);
AddPath("/boot/system/develop/headers/os/drivers", System, false);
AddPath("/boot/system/develop/headers/os/game", System, false);
AddPath("/boot/system/develop/headers/os/interface", System, false);
AddPath("/boot/system/develop/headers/os/kernel", System, false);
AddPath("/boot/system/develop/headers/os/locale", System, false);
AddPath("/boot/system/develop/headers/os/mail", System, false);
AddPath("/boot/system/develop/headers/os/media", System, false);
AddPath("/boot/system/develop/headers/os/midi", System, false);
AddPath("/boot/system/develop/headers/os/midi2", System, false);
AddPath("/boot/system/develop/headers/os/net", System, false);
AddPath("/boot/system/develop/headers/os/opengl", System, false);
AddPath("/boot/system/develop/headers/os/storage", System, false);
AddPath("/boot/system/develop/headers/os/support", System, false);
AddPath("/boot/system/develop/headers/os/translation", System, false);
AddPath("/boot/system/develop/headers/os/add-ons/graphics", System, false);
AddPath("/boot/system/develop/headers/os/add-ons/input_server", System, false);
AddPath("/boot/system/develop/headers/os/add-ons/mail_daemon", System, false);
AddPath("/boot/system/develop/headers/os/add-ons/registrar", System, false);
AddPath("/boot/system/develop/headers/os/add-ons/screen_saver", System, false);
AddPath("/boot/system/develop/headers/os/add-ons/tracker", System, false);
AddPath("/boot/system/develop/headers/os/be_apps/Deskbar", System, false);
AddPath("/boot/system/develop/headers/os/be_apps/NetPositive", System, false);
AddPath("/boot/system/develop/headers/os/be_apps/Tracker", System, false);
AddPath("/boot/system/develop/headers/3rdparty", System, false);
AddPath("/boot/system/develop/headers/bsd", System, false);
AddPath("/boot/system/develop/headers/glibc", System, false);
AddPath("/boot/system/develop/headers/posix", System, false);
AddPath("/boot/system/develop/headers", System, false);
break;
case llvm::Triple::RTEMS:
break;
//.........这里部分代码省略.........
示例3: AddDefaultCIncludePaths
void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
const HeaderSearchOptions &HSOpts) {
llvm::Triple::OSType os = triple.getOS();
if (HSOpts.UseStandardSystemIncludes) {
switch (os) {
case llvm::Triple::CloudABI:
case llvm::Triple::FreeBSD:
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
case llvm::Triple::Bitrig:
case llvm::Triple::NaCl:
break;
case llvm::Triple::Win32:
if (triple.getEnvironment() != llvm::Triple::Cygnus)
break;
default:
// FIXME: temporary hack: hard-coded paths.
AddPath("/usr/local/include", System, false);
break;
}
}
// Builtin includes use #include_next directives and should be positioned
// just prior C include dirs.
if (HSOpts.UseBuiltinIncludes) {
// Ignore the sys root, we *always* look for clang headers relative to
// supplied path.
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "include");
AddUnmappedPath(P, ExternCSystem, false);
}
// All remaining additions are for system include directories, early exit if
// we aren't using them.
if (!HSOpts.UseStandardSystemIncludes)
return;
// Add dirs specified via 'configure --with-c-include-dirs'.
StringRef CIncludeDirs(C_INCLUDE_DIRS);
if (CIncludeDirs != "") {
SmallVector<StringRef, 5> dirs;
CIncludeDirs.split(dirs, ":");
for (SmallVectorImpl<StringRef>::iterator i = dirs.begin();
i != dirs.end();
++i)
AddPath(*i, ExternCSystem, false);
return;
}
switch (os) {
case llvm::Triple::Linux:
llvm_unreachable("Include management is handled in the driver.");
case llvm::Triple::CloudABI: {
// <sysroot>/<triple>/include
SmallString<128> P = StringRef(HSOpts.ResourceDir);
llvm::sys::path::append(P, "../../..", triple.str(), "include");
AddPath(P, System, false);
break;
}
case llvm::Triple::Haiku:
AddPath("/boot/common/include", System, false);
AddPath("/boot/develop/headers/os", System, false);
AddPath("/boot/develop/headers/os/app", System, false);
AddPath("/boot/develop/headers/os/arch", System, false);
AddPath("/boot/develop/headers/os/device", System, false);
AddPath("/boot/develop/headers/os/drivers", System, false);
AddPath("/boot/develop/headers/os/game", System, false);
AddPath("/boot/develop/headers/os/interface", System, false);
AddPath("/boot/develop/headers/os/kernel", System, false);
AddPath("/boot/develop/headers/os/locale", System, false);
AddPath("/boot/develop/headers/os/mail", System, false);
AddPath("/boot/develop/headers/os/media", System, false);
AddPath("/boot/develop/headers/os/midi", System, false);
AddPath("/boot/develop/headers/os/midi2", System, false);
AddPath("/boot/develop/headers/os/net", System, false);
AddPath("/boot/develop/headers/os/storage", System, false);
AddPath("/boot/develop/headers/os/support", System, false);
AddPath("/boot/develop/headers/os/translation", System, false);
AddPath("/boot/develop/headers/os/add-ons/graphics", System, false);
AddPath("/boot/develop/headers/os/add-ons/input_server", System, false);
AddPath("/boot/develop/headers/os/add-ons/screen_saver", System, false);
AddPath("/boot/develop/headers/os/add-ons/tracker", System, false);
AddPath("/boot/develop/headers/os/be_apps/Deskbar", System, false);
AddPath("/boot/develop/headers/os/be_apps/NetPositive", System, false);
AddPath("/boot/develop/headers/os/be_apps/Tracker", System, false);
AddPath("/boot/develop/headers/cpp", System, false);
AddPath("/boot/develop/headers/cpp/i586-pc-haiku", System, false);
AddPath("/boot/develop/headers/3rdparty", System, false);
AddPath("/boot/develop/headers/bsd", System, false);
AddPath("/boot/develop/headers/glibc", System, false);
AddPath("/boot/develop/headers/posix", System, false);
AddPath("/boot/develop/headers", System, false);
break;
case llvm::Triple::RTEMS:
break;
case llvm::Triple::Win32:
switch (triple.getEnvironment()) {
//.........这里部分代码省略.........
示例4: CxxIncludeRoot
void InitHeaderSearch::
AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) {
llvm::Triple::OSType os = triple.getOS();
StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
if (CxxIncludeRoot != "") {
StringRef CxxIncludeArch(CXX_INCLUDE_ARCH);
if (CxxIncludeArch == "")
AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(),
CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
triple);
else
AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH,
CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR,
triple);
return;
}
// FIXME: temporary hack: hard-coded paths.
if (triple.isOSDarwin()) {
switch (triple.getArch()) {
default: break;
case llvm::Triple::ppc:
case llvm::Triple::ppc64:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
"powerpc-apple-darwin10", "", "ppc64",
triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
"powerpc-apple-darwin10", "", "ppc64",
triple);
break;
case llvm::Triple::x86:
case llvm::Triple::x86_64:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
"i686-apple-darwin10", "", "x86_64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
"i686-apple-darwin8", "", "", triple);
break;
case llvm::Triple::arm:
case llvm::Triple::thumb:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
"arm-apple-darwin10", "v7", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
"arm-apple-darwin10", "v6", "", triple);
break;
}
return;
}
switch (os) {
case llvm::Triple::Cygwin:
// Cygwin-1.7
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
// g++-4 / Cygwin-1.5
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
// FIXME: Do we support g++-3.4.4?
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
break;
case llvm::Triple::MinGW32:
// mingw-w64 C++ include paths (i686-w64-mingw32 and x86_64-w64-mingw32)
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.0");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.1");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.2");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.5.3");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.0");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.1");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.6.2");
AddMinGW64CXXPaths(HSOpts.ResourceDir, "4.7.0");
// mingw.org C++ include paths
AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2"); //MSYS
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0");
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");
break;
case llvm::Triple::DragonFly:
AddPath("/usr/include/c++/4.1", CXXSystem, true, false, false);
break;
case llvm::Triple::Linux:
//===------------------------------------------------------------------===//
// Debian based distros.
// Note: these distros symlink /usr/include/c++/X.Y.Z -> X.Y
//===------------------------------------------------------------------===//
// Ubuntu 11.11 "Oneiric Ocelot" -- gcc-4.6.0
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"i686-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"i486-linux-gnu", "", "64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.6",
"arm-linux-gnueabi", "", "", triple);
// Ubuntu 11.04 "Natty Narwhal" -- gcc-4.5.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.5",
"i686-linux-gnu", "", "64", triple);
//.........这里部分代码省略.........
示例5: AddDefaultCPlusPlusIncludePaths
void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) {
llvm::Triple::OSType os = triple.getOS();
llvm::StringRef CxxIncludeRoot(CXX_INCLUDE_ROOT);
if (CxxIncludeRoot != "") {
llvm::StringRef CxxIncludeArch(CXX_INCLUDE_ARCH);
if (CxxIncludeArch == "")
AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, triple.str().c_str(),
CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, triple);
else
AddGnuCPlusPlusIncludePaths(CxxIncludeRoot, CXX_INCLUDE_ARCH,
CXX_INCLUDE_32BIT_DIR, CXX_INCLUDE_64BIT_DIR, triple);
return;
}
// FIXME: temporary hack: hard-coded paths.
switch (os) {
case llvm::Triple::Cygwin:
AddPath("/lib/gcc/i686-pc-cygwin/3.4.4/include",
System, true, false, false);
AddPath("/lib/gcc/i686-pc-cygwin/3.4.4/include/c++",
System, true, false, false);
break;
case llvm::Triple::MinGW64:
// Try gcc 4.4.0
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.4.0");
// Try gcc 4.3.0
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw64", "4.3.0");
// Fall through.
case llvm::Triple::MinGW32:
// Try gcc 4.4.0
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
// Try gcc 4.3.0
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");
break;
case llvm::Triple::Darwin:
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1",
"i686-apple-darwin10", "", "x86_64", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0",
"i686-apple-darwin8", "", "", triple);
break;
case llvm::Triple::DragonFly:
AddPath("/usr/include/c++/4.1", System, true, false, false);
break;
case llvm::Triple::Linux:
// Exherbo (2010-01-25)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"x86_64-pc-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"i686-pc-linux-gnu", "", "", triple);
// Debian sid
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"x86_64-linux-gnu", "32", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"i486-linux-gnu", "64", "", triple);
// Ubuntu 7.10 - Gutsy Gibbon
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.3",
"i486-linux-gnu", "", "", triple);
// Ubuntu 9.04
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.3",
"x86_64-linux-gnu","32", "", triple);
// Ubuntu 9.10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
"x86_64-linux-gnu", "32", "", triple);
// Fedora 8
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.1.2",
"i386-redhat-linux", "", "", triple);
// Fedora 9
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.0",
"i386-redhat-linux", "", "", triple);
// Fedora 10
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
"i386-redhat-linux","", "", triple);
// Fedora 10 x86_64
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3.2",
"x86_64-redhat-linux", "32", "", triple);
// Fedora 11
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.1",
"i586-redhat-linux","", "", triple);
// Fedora 12
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.2",
"i686-redhat-linux","", "", triple);
// Fedora 12 (February-2010+)
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4.3",
"i686-redhat-linux","", "", triple);
// openSUSE 11.1 32 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"i586-suse-linux", "", "", triple);
// openSUSE 11.1 64 bit
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.3",
"x86_64-suse-linux", "32", "", triple);
// openSUSE 11.2
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"i586-suse-linux", "", "", triple);
AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.4",
"x86_64-suse-linux", "", "", triple);
// Arch Linux 2008-06-24
//.........这里部分代码省略.........