]> granicus.if.org Git - clang/commitdiff
Use early return. No functionality change.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 22 Oct 2013 15:18:22 +0000 (15:18 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 22 Oct 2013 15:18:22 +0000 (15:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193166 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index 5c4b59f09d5715f798610341ce17e707e83ad879..325366bef7f063707895cbf8e638ec25f38ae306 100644 (file)
@@ -9327,17 +9327,19 @@ void Sema::CheckForFunctionRedefinition(FunctionDecl *FD) {
   // Don't complain if we're in GNU89 mode and the previous definition
   // was an extern inline function.
   const FunctionDecl *Definition;
-  if (FD->isDefined(Definition) &&
-      !canRedefineFunction(Definition, getLangOpts())) {
-    if (getLangOpts().GNUMode && Definition->isInlineSpecified() &&
-        Definition->getStorageClass() == SC_Extern)
-      Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
+  if (!FD->isDefined(Definition) ||
+      canRedefineFunction(Definition, getLangOpts()))
+    return;
+
+  if (getLangOpts().GNUMode && Definition->isInlineSpecified() &&
+      Definition->getStorageClass() == SC_Extern)
+    Diag(FD->getLocation(), diag::err_redefinition_extern_inline)
         << FD->getDeclName() << getLangOpts().CPlusPlus;
-    else
-      Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
-    Diag(Definition->getLocation(), diag::note_previous_definition);
-    FD->setInvalidDecl();
-  }
+  else
+    Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName();
+
+  Diag(Definition->getLocation(), diag::note_previous_definition);
+  FD->setInvalidDecl();
 }
 
 Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) {