Skip to content
Snippets Groups Projects
Commit 3934d96f authored by George Burgess IV's avatar George Burgess IV
Browse files

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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299601 91177308-0d34-0410-b5e6-96231b3b80d8
parent 677f5363
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment