summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-22 15:18:22 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-22 15:18:22 +0000
commit69f531065ced9fcbe62750dc114326d4056b6639 (patch)
tree6358089479c05baacdb378ebf589dfe503b31343 /clang/lib/Sema/SemaDecl.cpp
parent57f30bce64e2515bd460262238ffdf0d4f168820 (diff)
downloadbcm5719-llvm-69f531065ced9fcbe62750dc114326d4056b6639.tar.gz
bcm5719-llvm-69f531065ced9fcbe62750dc114326d4056b6639.zip
Use early return. No functionality change.
llvm-svn: 193166
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 5c4b59f09d5..325366bef7f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -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) {
OpenPOWER on IntegriCloud