Skip to content

Commit 8ca5ff2

Browse files
authored
Revert "[clang][driver] Fix -print-target-triple OS version for apple targets" (#104563)
This reverts #104037 / 7227b44. This change had the unintended consequence of making e.g. `clang -target armv7-windows-gnu --print-target-triple` output `thumbv7-unknown-windows-gnu` rather than `armv7-unknown-windows-gnu`.
1 parent 59d7df4 commit 8ca5ff2

File tree

2 files changed

+3
-52
lines changed

2 files changed

+3
-52
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,8 @@ bool Driver::HandleImmediateArgs(Compilation &C) {
22712271
return false;
22722272
}
22732273

2274-
auto initializeTargets = [&]() {
2274+
if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
2275+
ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
22752276
const llvm::Triple Triple(TC.ComputeEffectiveClangTriple(C.getArgs()));
22762277
// The 'Darwin' toolchain is initialized only when its arguments are
22772278
// computed. Get the default arguments for OFK_None to ensure that
@@ -2281,12 +2282,6 @@ bool Driver::HandleImmediateArgs(Compilation &C) {
22812282
// FIXME: For some more esoteric targets the default toolchain is not the
22822283
// correct one.
22832284
C.getArgsForToolChain(&TC, Triple.getArchName(), Action::OFK_None);
2284-
return Triple;
2285-
};
2286-
2287-
if (C.getArgs().hasArg(options::OPT_print_libgcc_file_name)) {
2288-
ToolChain::RuntimeLibType RLT = TC.GetRuntimeLibType(C.getArgs());
2289-
const llvm::Triple Triple = initializeTargets();
22902285
RegisterEffectiveTriple TripleRAII(TC, Triple);
22912286
switch (RLT) {
22922287
case ToolChain::RLT_CompilerRT:
@@ -2330,9 +2325,7 @@ bool Driver::HandleImmediateArgs(Compilation &C) {
23302325
}
23312326

23322327
if (C.getArgs().hasArg(options::OPT_print_target_triple)) {
2333-
initializeTargets();
2334-
llvm::Triple Triple(TC.ComputeEffectiveClangTriple(C.getArgs()));
2335-
llvm::outs() << Triple.getTriple() << "\n";
2328+
llvm::outs() << TC.getTripleString() << "\n";
23362329
return false;
23372330
}
23382331

clang/test/Driver/darwin-print-target-triple.c

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)