summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2017-04-06 00:08:35 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2017-04-06 00:08:35 +0000
commit05859d82383c90e98abe39f55502aa03915812c9 (patch)
treed9a329471af65be77670113305074810aa298902
parent5c65088fd4c18d94713ddd33dfaffa8f757cbdd7 (diff)
downloadbcm5719-llvm-05859d82383c90e98abe39f55502aa03915812c9.tar.gz
bcm5719-llvm-05859d82383c90e98abe39f55502aa03915812c9.zip
Simplify. NFC.
Two simplifications: - We check `!Previous.empty()` above and only use `Previous` in const contexts after that check, so the `!Previous.empty()` check seems redundant. - The null check looks pointless, as well: AFAICT, `LookupResults` should never contain null entries, and `OldDecl` should always be non-null if `Redeclaration` is true. llvm-svn: 299601
-rw-r--r--clang/lib/Sema/SemaDecl.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index c0a10158405..02cbca8b2bb 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -9038,14 +9038,10 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD,
// with that name must be marked "overloadable".
Diag(NewFD->getLocation(), diag::err_attribute_overloadable_missing)
<< Redeclaration << NewFD;
- NamedDecl *OverloadedDecl = nullptr;
- if (Redeclaration)
- OverloadedDecl = OldDecl;
- else if (!Previous.empty())
- OverloadedDecl = Previous.getRepresentativeDecl();
- if (OverloadedDecl)
- Diag(OverloadedDecl->getLocation(),
- diag::note_attribute_overloadable_prev_overload);
+ NamedDecl *OverloadedDecl =
+ Redeclaration ? OldDecl : Previous.getRepresentativeDecl();
+ Diag(OverloadedDecl->getLocation(),
+ diag::note_attribute_overloadable_prev_overload);
NewFD->addAttr(OverloadableAttr::CreateImplicit(Context));
}
}
OpenPOWER on IntegriCloud