diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/Parser.cpp | 7 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 48 |
2 files changed, 2 insertions, 53 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 49928dc1d2..dd6d527a66 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -1278,18 +1278,13 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) { return true; if (Tok.is(tok::identifier)) { - IdentifierInfo *CorrectedII = 0; // Determine whether the identifier is a type name. if (ParsedType Ty = Actions.getTypeName(*Tok.getIdentifierInfo(), Tok.getLocation(), getCurScope(), &SS, false, NextToken().is(tok::period), ParsedType(), - /*NonTrivialTypeSourceInfo*/true, - &CorrectedII)) { - // A FixIt was applied as a result of typo correction - if (CorrectedII) - Tok.setIdentifierInfo(CorrectedII); + /*NonTrivialTypeSourceInfo*/true)) { // This is a typename. Replace the current token in-place with an // annotation type token. Tok.setKind(tok::annot_typename); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c002dd3d0e..f6bfb3a2f2 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -70,8 +70,7 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS, bool isClassName, bool HasTrailingDot, ParsedType ObjectTypePtr, - bool WantNontrivialTypeSourceInfo, - IdentifierInfo **CorrectedII) { + bool WantNontrivialTypeSourceInfo) { // Determine where we will perform name lookup. DeclContext *LookupCtx = 0; if (ObjectTypePtr) { @@ -146,51 +145,6 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, switch (Result.getResultKind()) { case LookupResult::NotFound: case LookupResult::NotFoundInCurrentInstantiation: - if (CorrectedII) { - TypoCorrection Correction = CorrectTypo(Result.getLookupNameInfo(), - Kind, S, SS, 0, false, - Sema::CTC_Type); - IdentifierInfo *NewII = Correction.getCorrectionAsIdentifierInfo(); - TemplateTy Template; - bool MemberOfUnknownSpecialization; - UnqualifiedId TemplateName; - TemplateName.setIdentifier(NewII, NameLoc); - NestedNameSpecifier *NNS = Correction.getCorrectionSpecifier(); - CXXScopeSpec NewSS, *NewSSPtr = SS; - if (SS && NNS) { - NewSS.MakeTrivial(Context, NNS, SourceRange(NameLoc)); - NewSSPtr = &NewSS; - } - if (Correction && (NNS || NewII != &II) && - // Ignore a correction to a template type as the to-be-corrected - // identifier is not a template (typo correction for template names - // is handled elsewhere). - !(getLangOptions().CPlusPlus && NewSSPtr && - isTemplateName(S, *NewSSPtr, false, TemplateName, ParsedType(), - false, Template, MemberOfUnknownSpecialization))) { - ParsedType Ty = getTypeName(*NewII, NameLoc, S, NewSSPtr, - isClassName, HasTrailingDot, ObjectTypePtr, - WantNontrivialTypeSourceInfo); - if (Ty) { - std::string CorrectedStr(Correction.getAsString(getLangOptions())); - std::string CorrectedQuotedStr( - Correction.getQuoted(getLangOptions())); - Diag(NameLoc, diag::err_unknown_typename_suggest) - << Result.getLookupName() << CorrectedQuotedStr - << FixItHint::CreateReplacement(SourceRange(NameLoc), - CorrectedStr); - if (NamedDecl *FirstDecl = Correction.getCorrectionDecl()) - Diag(FirstDecl->getLocation(), diag::note_previous_decl) - << CorrectedQuotedStr; - - if (SS && NNS) - SS->MakeTrivial(Context, NNS, SourceRange(NameLoc)); - *CorrectedII = NewII; - return Ty; - } - } - } - // If typo correction failed or was not performed, fall through case LookupResult::FoundOverloaded: case LookupResult::FoundUnresolvedValue: Result.suppressDiagnostics(); |