]> granicus.if.org Git - clang/commit
The Clang gcc-compatible driver (clang/tools/driver/driver.cpp) has some
authorEric Christopher <echristo@gmail.com>
Fri, 25 Sep 2015 17:44:31 +0000 (17:44 +0000)
committerEric Christopher <echristo@gmail.com>
Fri, 25 Sep 2015 17:44:31 +0000 (17:44 +0000)
commit8a5a78bee32d0f581986b0eab1fc639166ea5a27
tree868da9882c194be2baa3ef7bae52e28eaaec2abb
parentfc7ebbf51285f899d476d4eea540ac040668c1d0
The Clang gcc-compatible driver (clang/tools/driver/driver.cpp) has some
logic to select an alternate target based on the executable it was
called as. For instance, if you symlink i686-linux-android-gcc to clang
and invoke it, the driver will act as though it were called with another
argument ("-target i686-linux-android"). This leads to visible effects
even in syntax-only compilations (like the ANDROID preprocessor symbol
being defined).

This behavior is not replicated for tool invocations--for instance,
clang::createInvocationFromCommandLine will not choose an alternate
target based on ArgList[0]. This means that configurations stored in
compilation databases aren't accurately replayed.

This patch separates the logic for selecting a mode flag and target from
the executable name into a new member function on ToolChain. It should
have no functional effects (but will allow other code to reuse the
target/mode selection logic).

Patch by Luke Zarko!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248592 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Driver/ToolChain.h
lib/Driver/ToolChain.cpp
tools/driver/driver.cpp