diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-01-13 00:47:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-01-13 00:47:51 +0000 |
commit | a817b77bbb6d4dcb75d598a7e14e77db467b7171 (patch) | |
tree | 778364b0564f9bf43166b1a69a56ea11ece177a9 /tools/driver/cc1_main.cpp | |
parent | 220ccbf2c9ef97034cce80561f9f46c4f1f63bc7 (diff) |
cc1: Lift creation of the FrontendAction higher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93281 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/driver/cc1_main.cpp')
-rw-r--r-- | tools/driver/cc1_main.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index eb1f60ccb6..d901c6f8a1 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -249,8 +249,11 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, Diags.Report(diag::err_fe_unable_to_load_plugin) << Path << Error; } + // Create the frontend action. + llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(Clang)); + // If there were any errors in processing arguments, exit now. - if (Clang.getDiagnostics().getNumErrors()) + if (!Act || Clang.getDiagnostics().getNumErrors()) return 1; // Create the target instance. @@ -259,13 +262,13 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, if (!Clang.hasTarget()) return 1; - // Inform the target of the language options + // Inform the target of the language options. // // FIXME: We shouldn't need to do this, the target should be immutable once // created. This complexity should be lifted elsewhere. Clang.getTarget().setForcedLangOptions(Clang.getLangOpts()); - // Validate/process some options + // Validate/process some options. if (Clang.getHeaderSearchOpts().Verbose) llvm::errs() << "clang -cc1 version " CLANG_VERSION_STRING << " based upon " << PACKAGE_STRING @@ -298,10 +301,6 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, Clang.createPreprocessor(); } - llvm::OwningPtr<FrontendAction> Act(CreateFrontendAction(Clang)); - if (!Act) - break; - if (Act->BeginSourceFile(Clang, InFile, IsAST)) { Act->Execute(); Act->EndSourceFile(); |