r299601 - Simplify. NFC.
George Burgess IV via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 5 17:08:35 PDT 2017
Author: gbiv
Date: Wed Apr 5 19:08:35 2017
New Revision: 299601
URL: http://llvm.org/viewvc/llvm-project?rev=299601&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=299601&r1=299600&r2=299601&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Apr 5 19:08:35 2017
@@ -9038,14 +9038,10 @@ bool Sema::CheckFunctionDeclaration(Scop
// 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));
}
}
More information about the cfe-commits
mailing list