From: Sean Silva Date: Sun, 6 Jan 2013 07:49:41 +0000 (+0000) Subject: use early returns to simplify and de-nest X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8da06bbd90d070c9a43557b6ecd55583db5b4083;p=clang 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 --- 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 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 Act(CreateFrontendAction(*Clang)); + if (!Act) + return false; + bool Success = Clang->ExecuteAction(*Act); + if (Clang->getFrontendOpts().DisableFree) + Act.take(); return Success; }