diff options
author | Sean Silva <silvas@purdue.edu> | 2013-01-06 07:49:41 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2013-01-06 07:49:41 +0000 |
commit | 8da06bbd90d070c9a43557b6ecd55583db5b4083 (patch) | |
tree | 8ae7827379e12f894922c9fffc6eab2ba4787be4 /lib/FrontendTool/ExecuteCompilerInvocation.cpp | |
parent | f6fd00b12ae7d89436d32851c9bcc8dd3d046ad3 (diff) |
use early returns to simplify and de-nest
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r-- | lib/FrontendTool/ExecuteCompilerInvocation.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 8cc25924f2..ad8eb04768 100644 --- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -226,16 +226,14 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) { #endif // If there were errors in processing arguments, don't do anything else. - bool Success = false; - if (!Clang->getDiagnostics().hasErrorOccurred()) { - // Create and execute the frontend action. - OwningPtr<FrontendAction> Act(CreateFrontendAction(*Clang)); - if (Act) { - Success = Clang->ExecuteAction(*Act); - if (Clang->getFrontendOpts().DisableFree) - Act.take(); - } - } - + if (Clang->getDiagnostics().hasErrorOccurred()) + return false; + // Create and execute the frontend action. + OwningPtr<FrontendAction> Act(CreateFrontendAction(*Clang)); + if (!Act) + return false; + bool Success = Clang->ExecuteAction(*Act); + if (Clang->getFrontendOpts().DisableFree) + Act.take(); return Success; } |