aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-03-20 00:50:21 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-03-20 00:50:21 +0000
commit03d87ee556f9e11ab83f6d2f80c9ee92e3667301 (patch)
treed0e64dc3a62b4a246b7bc710402e51824d4f1191 /lib/Driver/Tools.cpp
parent788f5a1242c04762f91eaa7565c07b9865846d88 (diff)
Driver: Fix possible crash when targetting an unknown (unsupported) Darwin
platform, e.g. ppc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99016 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 86b46856d3..58a4cdb89b 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -655,6 +655,12 @@ static std::string getEffectiveClangTriple(const Driver &D,
} else {
const toolchains::Darwin &DarwinTC(
reinterpret_cast<const toolchains::Darwin&>(TC));
+
+ // If the target isn't initialized (e.g., an unknown Darwin platform, return
+ // the default triple).
+ if (!DarwinTC.isTargetInitialized())
+ return Triple.getTriple();
+
unsigned Version[3];
DarwinTC.getTargetVersion(Version);