[PATCH] D12982: Move routines for guessing mode/target from driver to ToolChain

Luke Zarko via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 13:27:00 PDT 2015


zarko created this revision.
zarko added reviewers: rnk, echristo.
zarko added a subscriber: cfe-commits.
zarko set the repository for this revision to rL LLVM.
Herald added subscribers: srhines, danalbert, tberghammer.

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 diff 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).

Repository:
  rL LLVM

http://reviews.llvm.org/D12982

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  tools/driver/driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12982.35129.patch
Type: text/x-patch
Size: 11284 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150918/74fcc0cd/attachment.bin>


More information about the cfe-commits mailing list