ccc: Embrace destiny as a clang compiler driver.
This redoes the default mode that ccc runs in w.r.t. using clang. Now
ccc defaults to always using clang for any task clang can
handle. However, the following options exist to tweak this behavior:
-ccc-no-clang: Don't use clang at all for compilation (still used for
static analysis).
-ccc-no-clang-cxx: Don't use clang for C++ and Objective-C++ inputs.
-ccc-no-clang-cpp: Don't use clang as a preprocessor.
-ccc-clang-archs <archs>: If present, only use clang for the given
comma separated list of architectures. This only works on Darwin for
now.
Note that all -ccc options must be first on the command line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63346 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/Driver.py b/tools/ccc/ccclib/Driver.py
index 6749dae..bdcdcb7 100644
--- a/tools/ccc/ccclib/Driver.py
+++ b/tools/ccc/ccclib/Driver.py
@@ -28,9 +28,10 @@
self.cccHostBits = self.cccHostMachine = None
self.cccHostSystem = self.cccHostRelease = None
self.cccCXX = False
- self.cccClang = False
self.cccEcho = False
self.cccFallback = False
+ self.cccNoClang = self.cccNoClangCXX = self.cccNoClangPreprocessor = False
+ self.cccClangArchs = None
# Certain options suppress the 'no input files' warning.
self.suppressMissingInputWarning = False
@@ -115,12 +116,10 @@
# FIXME: How to handle override of host? ccc specific options?
# Abuse -b?
- if self.getenvBool('CCC_CLANG'):
- self.cccClang = True
- if self.getenvBool('CCC_ECHO'):
- self.cccEcho = True
- if self.getenvBool('CCC_FALLBACK'):
- self.cccFallback = True
+ arg = os.getenv('CCC_ADD_ARGS')
+ if arg:
+ args = filter(None, map(str.strip, arg.split(',')))
+ argv = args + argv
while argv and argv[0].startswith('-ccc-'):
fullOpt,argv = argv[0],argv[1:]
@@ -132,12 +131,20 @@
cccPrintPhases = True
elif opt == 'cxx':
self.cccCXX = True
- elif opt == 'clang':
- self.cccClang = True
elif opt == 'echo':
self.cccEcho = True
elif opt == 'fallback':
self.cccFallback = True
+
+ elif opt == 'no-clang':
+ self.cccNoClang = True
+ elif opt == 'no-clang-cxx':
+ self.cccNoClangCXX = True
+ elif opt == 'no-clang-cpp':
+ self.cccNoClangPreprocessor = True
+ elif opt == 'clang-archs':
+ self.cccClangArchs,argv = argv[0].split(','),argv[1:]
+
elif opt == 'host-bits':
self.cccHostBits,argv = argv[0],argv[1:]
elif opt == 'host-machine':