зеркало из https://github.com/microsoft/clang-1.git
Simplify some code, don't force the triple to a darwin triple if non-darwin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
aeae19c427
Коммит
6590d21767
|
@ -426,37 +426,26 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateTargetTriples(std::vector<std::string>& triples) {
|
static void CreateTargetTriples(std::vector<std::string>& triples) {
|
||||||
std::string base_triple;
|
|
||||||
|
|
||||||
// Initialize base triple. If a -triple option has been specified, use
|
// Initialize base triple. If a -triple option has been specified, use
|
||||||
// that triple. Otherwise, default to the host triple.
|
// that triple. Otherwise, default to the host triple.
|
||||||
if (TargetTriple.getValue().empty()) {
|
std::string Triple = TargetTriple;
|
||||||
// HACK: For non-darwin systems, we don't have any real target support
|
if (Triple.empty()) Triple = LLVM_HOSTTRIPLE;
|
||||||
// yet. For these systems, set the target to darwin.
|
|
||||||
if (!strstr(LLVM_HOSTTRIPLE,"darwin"))
|
|
||||||
base_triple = "i386-apple-darwin";
|
|
||||||
else
|
|
||||||
base_triple = LLVM_HOSTTRIPLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
base_triple = TargetTriple.getValue();
|
|
||||||
|
|
||||||
// Decompose the base triple into "arch" and suffix.
|
// Decompose the base triple into "arch" and suffix.
|
||||||
std::string::size_type firstDash = base_triple.find("-");
|
std::string::size_type firstDash = Triple.find("-");
|
||||||
|
|
||||||
if (firstDash == std::string::npos) {
|
if (firstDash == std::string::npos) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Malformed target triple: \"%s\" ('-' could not be found).\n",
|
"Malformed target triple: \"%s\" ('-' could not be found).\n",
|
||||||
base_triple.c_str());
|
Triple.c_str());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string suffix(base_triple,firstDash+1);
|
std::string suffix(Triple, firstDash+1);
|
||||||
|
|
||||||
if (suffix.empty()) {
|
if (suffix.empty()) {
|
||||||
fprintf(stderr,
|
fprintf(stderr, "Malformed target triple: \"%s\" (no vendor or OS).\n",
|
||||||
"Malformed target triple: \"%s\" (no vendor or OS).\n",
|
Triple.c_str());
|
||||||
base_triple.c_str());
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +455,7 @@ static void CreateTargetTriples(std::vector<std::string>& triples) {
|
||||||
// Add the primary triple to our set of triples if we are using the
|
// Add the primary triple to our set of triples if we are using the
|
||||||
// host-triple with no archs or using a specified target triple.
|
// host-triple with no archs or using a specified target triple.
|
||||||
if (!TargetTriple.getValue().empty() || Archs.empty())
|
if (!TargetTriple.getValue().empty() || Archs.empty())
|
||||||
tp.addTriple(base_triple);
|
tp.addTriple(Triple);
|
||||||
|
|
||||||
for (unsigned i = 0, e = Archs.size(); i !=e; ++i)
|
for (unsigned i = 0, e = Archs.size(); i !=e; ++i)
|
||||||
tp.addTriple(Archs[i] + "-" + suffix);
|
tp.addTriple(Archs[i] + "-" + suffix);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче