summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2011-09-14 19:37:32 +0000
committerKaelyn Uhrain <rikka@google.com>2011-09-14 19:37:32 +0000
commit7fbe2f78d7c0ba4106e281265f512c53aa77276e (patch)
tree103ca044fa8d7a104bfe05b63ff53a1f135f8eb0 /clang/lib
parente9d80bbc1d119cc0fc8aa3a0f91866264b0eb58f (diff)
downloadbcm5719-llvm-7fbe2f78d7c0ba4106e281265f512c53aa77276e.tar.gz
bcm5719-llvm-7fbe2f78d7c0ba4106e281265f512c53aa77276e.zip
Plug an abstraction leak and fix a crasher in DiagnoseInvalidRedeclaration
llvm-svn: 139718
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 96531d41459..abc3cf1938f 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -4284,8 +4284,6 @@ static void DiagnoseInvalidRedeclaration(Sema &S, FunctionDecl *NewFD,
} else if ((Correction = S.CorrectTypo(Prev.getLookupNameInfo(),
Prev.getLookupKind(), 0, 0, DC)) &&
Correction.getCorrection() != Name) {
- DiagMsg = isFriendDecl ? diag::err_no_matching_local_friend_suggest
- : diag::err_member_def_does_not_match_suggest;
for (TypoCorrection::decl_iterator CDecl = Correction.begin(),
CDeclEnd = Correction.end();
CDecl != CDeclEnd; ++CDecl) {
@@ -4299,8 +4297,15 @@ static void DiagnoseInvalidRedeclaration(Sema &S, FunctionDecl *NewFD,
NearMatches.push_back(std::make_pair(FD, ParamNum));
}
}
+ if (!NearMatches.empty())
+ DiagMsg = isFriendDecl ? diag::err_no_matching_local_friend_suggest
+ : diag::err_member_def_does_not_match_suggest;
}
+ // Ignore the correction if it didn't yield any close FunctionDecl matches
+ if (Correction && NearMatches.empty())
+ Correction = TypoCorrection();
+
if (Correction)
S.Diag(NewFD->getLocation(), DiagMsg)
<< Name << DC << Correction.getQuoted(S.getLangOptions())
OpenPOWER on IntegriCloud