diff options
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 12 |
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)); } } |

