forked from OSchip/llvm-project
Driver: Run 'clang' in C++ mode based on the name it was invoked by. We match
anything that ends with ++ or ++-FOO (e.g., c++, clang++, clang++-1.1) as being a "C++ compiler". This allows easy testing of the C++ compiler by 'ln -s clang clang++', or by 'cp clang clang++'. Based on patch by Roman Divacky. llvm-svn: 86697
This commit is contained in:
parent
ef2919f1fa
commit
f76c9d270a
|
@ -197,6 +197,15 @@ int main(int argc, const char **argv) {
|
|||
llvm::sys::getHostTriple().c_str(),
|
||||
"a.out", IsProduction, Diags);
|
||||
|
||||
// Check for ".*++" or ".*++-[^-]*" to determine if we are a C++
|
||||
// compiler. This matches things like "c++", "clang++", and "clang++-1.1".
|
||||
//
|
||||
// Note that we intentionally want to use argv[0] here, to support "clang++"
|
||||
// being a symlink.
|
||||
llvm::StringRef ProgName(llvm::sys::Path(argv[0]).getBasename());
|
||||
if (ProgName.endswith("++") || ProgName.rsplit('-').first.endswith("++"))
|
||||
TheDriver.CCCIsCXX = true;
|
||||
|
||||
llvm::OwningPtr<Compilation> C;
|
||||
|
||||
// Handle QA_OVERRIDE_GCC3_OPTIONS and CCC_ADD_ARGS, used for editing a
|
||||
|
|
Loading…
Reference in New Issue