r191459 - Fix error recovery when a return type correction includes a new name specifier.
Kaelyn Uhrain
rikka at google.com
Thu Sep 26 14:13:06 PDT 2013
Author: rikka
Date: Thu Sep 26 16:13:05 2013
New Revision: 191459
URL: http://llvm.org/viewvc/llvm-project?rev=191459&view=rev
Log:
Fix error recovery when a return type correction includes a new name specifier.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=191459&r1=191458&r2=191459&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Sep 26 16:13:05 2013
@@ -426,8 +426,13 @@ bool Sema::DiagnoseUnknownTypeName(Ident
llvm_unreachable("could not have corrected a typo here");
}
+ CXXScopeSpec tmpSS;
+ if (Corrected.getCorrectionSpecifier())
+ tmpSS.MakeTrivial(Context, Corrected.getCorrectionSpecifier(),
+ SourceRange(IILoc));
SuggestedType = getTypeName(*Corrected.getCorrectionAsIdentifierInfo(),
- IILoc, S, SS, false, false, ParsedType(),
+ IILoc, S, tmpSS.isSet() ? &tmpSS : SS, false,
+ false, ParsedType(),
/*IsCtorOrDtorName=*/false,
/*NonTrivialTypeSourceInfo=*/true);
}
Modified: cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp?rev=191459&r1=191458&r2=191459&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp Thu Sep 26 16:13:05 2013
@@ -47,9 +47,7 @@ public:
};
Inner Outer::MyMethod(Inner arg) { // expected-error {{unknown type name 'Inner'; did you mean 'Outer::Inner'?}}
- // TODO: Recovery needs to be fixed/added for the typo-correction of the
- // return type so the below error isn't still generated.
- return Inner(); // expected-error {{no viable conversion from 'class_member_typo_corrections::Outer::Inner' to 'int'}}
+ return Inner();
}
class Result {
More information about the cfe-commits
mailing list