]> granicus.if.org Git - clang/commit
[Support] Avoid normalization in sys::getDefaultTargetTriple
authorPetr Hosek <phosek@chromium.org>
Fri, 25 May 2018 20:39:37 +0000 (20:39 +0000)
committerPetr Hosek <phosek@chromium.org>
Fri, 25 May 2018 20:39:37 +0000 (20:39 +0000)
commitb3ab2ec725f7ee7e701eed827c0a68c4d0d4d943
treef7e06f89ee93b98a5033e2202e03db7b945fdbc3
parent19379d6c2a67a04e7290b5edaf3b3508ff29b671
[Support] Avoid normalization in sys::getDefaultTargetTriple

The return value of sys::getDefaultTargetTriple, which is derived from
-DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target,
and in the future also to control the search path directly; as such it
should be used textually, without interpretation by LLVM.

Normalization of this value may lead to unexpected results, for example
if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu,
normalization will transform that value to x86_64--linux-gnu. Driver will
use that value to search for tools prefixed with x86_64--linux-gnu- which
may be confusing. This is also inconsistent with the behavior of the
--target flag which is taken as-is without any normalization and overrides
the value of LLVM_DEFAULT_TARGET_TRIPLE.

Users of sys::getDefaultTargetTriple already perform their own
normalization as needed, so this change shouldn't impact existing logic.

Differential Revision: https://reviews.llvm.org/D47153

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333307 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/CompilerInvocation.cpp