r215759 - [cleanup] Factor out handling CC1 tools. NFC.
Sean Silva
chisophugis at gmail.com
Fri Aug 15 12:23:47 PDT 2014
Author: silvas
Date: Fri Aug 15 14:23:47 2014
New Revision: 215759
URL: http://llvm.org/viewvc/llvm-project?rev=215759&view=rev
Log:
[cleanup] Factor out handling CC1 tools. NFC.
Modified:
cfe/trunk/tools/driver/driver.cpp
Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=215759&r1=215758&r2=215759&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Fri Aug 15 14:23:47 2014
@@ -357,6 +357,19 @@ static void SetInstallDir(SmallVectorImp
TheDriver.setInstalledDir(InstalledPath);
}
+static int HandleCC1Tool(SmallVectorImpl<const char *> &argv, StringRef Tool) {
+ if (Tool == "")
+ return cc1_main(argv.data()+2, argv.data()+argv.size(), argv[0],
+ (void*) (intptr_t) GetExecutablePath);
+ if (Tool == "as")
+ return cc1as_main(argv.data()+2, argv.data()+argv.size(), argv[0],
+ (void*) (intptr_t) GetExecutablePath);
+
+ // Reject unknown tools.
+ llvm::errs() << "error: unknown integrated tool '" << Tool << "'\n";
+ return 1;
+}
+
int main(int argc_, const char **argv_) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc_, argv_);
@@ -375,20 +388,8 @@ int main(int argc_, const char **argv_)
llvm::cl::ExpandResponseFiles(Saver, llvm::cl::TokenizeGNUCommandLine, argv);
// Handle -cc1 integrated tools.
- if (argv.size() > 1 && StringRef(argv[1]).startswith("-cc1")) {
- StringRef Tool = argv[1] + 4;
-
- if (Tool == "")
- return cc1_main(argv.data()+2, argv.data()+argv.size(), argv[0],
- (void*) (intptr_t) GetExecutablePath);
- if (Tool == "as")
- return cc1as_main(argv.data()+2, argv.data()+argv.size(), argv[0],
- (void*) (intptr_t) GetExecutablePath);
-
- // Reject unknown tools.
- llvm::errs() << "error: unknown integrated tool '" << Tool << "'\n";
- return 1;
- }
+ if (argv.size() > 1 && StringRef(argv[1]).startswith("-cc1"))
+ return HandleCC1Tool(argv, argv[1] + 4);
bool CanonicalPrefixes = true;
for (int i = 1, size = argv.size(); i < size; ++i) {
More information about the cfe-commits
mailing list