diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 17 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 8 |
3 files changed, 18 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a171217073e..6574ad2e87d 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -803,6 +803,15 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { else Old = dyn_cast<FunctionDecl>(OldD); if (!Old) { + if (UsingShadowDecl *Shadow = dyn_cast<UsingShadowDecl>(OldD)) { + Diag(New->getLocation(), diag::err_using_decl_conflict_reverse); + Diag(Shadow->getTargetDecl()->getLocation(), + diag::note_using_decl_target); + Diag(Shadow->getUsingDecl()->getLocation(), + diag::note_using_decl) << 0; + return true; + } + Diag(New->getLocation(), diag::err_redefinition_different_kind) << New->getDeclName(); Diag(OldD->getLocation(), diag::note_previous_definition); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index f97b7637451..70ee24c68e8 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2995,9 +2995,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, return false; case Ovl_NonFunction: - Diag(Using->getLocation(), diag::err_using_decl_conflict) - << 0 // target decl is a function - << 1; // other decl is not a function + Diag(Using->getLocation(), diag::err_using_decl_conflict); break; // We found a decl with the exact signature. @@ -3014,9 +3012,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, return true; // If we're not in a record, this is an error. - Diag(Using->getLocation(), diag::err_using_decl_conflict) - << 0 // target decl is a function - << 0; // other decl is a function + Diag(Using->getLocation(), diag::err_using_decl_conflict); break; } @@ -3043,8 +3039,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, // No conflict between a tag and a non-tag. if (!Tag) return false; - Diag(Using->getLocation(), diag::err_using_decl_conflict) - << 1 << 1; // both non-functions + Diag(Using->getLocation(), diag::err_using_decl_conflict); Diag(Target->getLocation(), diag::note_using_decl_target); Diag(Tag->getLocation(), diag::note_using_decl_conflict); return true; @@ -3053,9 +3048,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, // No conflict between a tag and a non-tag. if (!NonTag) return false; - Diag(Using->getLocation(), diag::err_using_decl_conflict) - << 1 // target not a function - << int(NonTag->isFunctionOrFunctionTemplate()); + Diag(Using->getLocation(), diag::err_using_decl_conflict); Diag(Target->getLocation(), diag::note_using_decl_target); Diag(NonTag->getLocation(), diag::note_using_decl_conflict); return true; @@ -3335,7 +3328,7 @@ bool Sema::CheckUsingDeclRedeclaration(SourceLocation UsingLoc, continue; Diag(NameLoc, diag::err_using_decl_redeclaration) << SS.getRange(); - Diag(D->getLocation(), diag::note_previous_using_decl); + Diag(D->getLocation(), diag::note_using_decl) << 1; return true; } diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 7f46d2c4384..a768e1bdf78 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1349,10 +1349,10 @@ ObjCMethodDecl *Sema::LookupInstanceMethodInGlobalPool(Selector Sel, } if (issueWarning && (MethList.Method && MethList.Next)) { Diag(R.getBegin(), diag::warn_multiple_method_decl) << Sel << R; - Diag(MethList.Method->getLocStart(), diag::note_using_decl) + Diag(MethList.Method->getLocStart(), diag::note_using) << MethList.Method->getSourceRange(); for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next) - Diag(Next->Method->getLocStart(), diag::note_also_found_decl) + Diag(Next->Method->getLocStart(), diag::note_also_found) << Next->Method->getSourceRange(); } return MethList.Method; @@ -1413,10 +1413,10 @@ ObjCMethodDecl *Sema::LookupFactoryMethodInGlobalPool(Selector Sel, } if (issueWarning && (MethList.Method && MethList.Next)) { Diag(R.getBegin(), diag::warn_multiple_method_decl) << Sel << R; - Diag(MethList.Method->getLocStart(), diag::note_using_decl) + Diag(MethList.Method->getLocStart(), diag::note_using) << MethList.Method->getSourceRange(); for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next) - Diag(Next->Method->getLocStart(), diag::note_also_found_decl) + Diag(Next->Method->getLocStart(), diag::note_also_found) << Next->Method->getSourceRange(); } return MethList.Method; |