diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp index 01ac8f7..554a114 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -160,16 +160,6 @@ bool Sema::isDependentScopeSpecifier(const CXXScopeSpec &SS) { return SS.getScopeRep()->isDependent(); } -// \brief Determine whether this C++ scope specifier refers to an -// unknown specialization, i.e., a dependent type that is not the -// current instantiation. -bool Sema::isUnknownSpecialization(const CXXScopeSpec &SS) { - if (!isDependentScopeSpecifier(SS)) - return false; - - return getCurrentInstantiationOf(SS.getScopeRep()) == 0; -} - /// \brief If the given nested name specifier refers to the current /// instantiation, return the declaration that corresponds to that /// current instantiation (C++0x [temp.dep.type]p1). @@ -494,32 +484,30 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // FIXME: Deal with ambiguities cleanly. - if (Found.empty() && !ErrorRecoveryLookup) { + if (Found.empty() && !ErrorRecoveryLookup && !getLangOpts().MicrosoftMode) { // We haven't found anything, and we're not recovering from a // different kind of error, so look for typos. DeclarationName Name = Found.getLookupName(); NestedNameSpecifierValidatorCCC Validator(*this); - TypoCorrection Corrected; Found.clear(); - if ((Corrected = CorrectTypo(Found.getLookupNameInfo(), - Found.getLookupKind(), S, &SS, Validator, - LookupCtx, EnteringContext))) { - std::string CorrectedStr(Corrected.getAsString(getLangOpts())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); - if (LookupCtx) - Diag(Found.getNameLoc(), diag::err_no_member_suggest) - << Name << LookupCtx << CorrectedQuotedStr << SS.getRange() - << FixItHint::CreateReplacement(Corrected.getCorrectionRange(), - CorrectedStr); - else - Diag(Found.getNameLoc(), diag::err_undeclared_var_use_suggest) - << Name << CorrectedQuotedStr - << FixItHint::CreateReplacement(Found.getNameLoc(), CorrectedStr); - - if (NamedDecl *ND = Corrected.getCorrectionDecl()) { - Diag(ND->getLocation(), diag::note_previous_decl) << CorrectedQuotedStr; + if (TypoCorrection Corrected = + CorrectTypo(Found.getLookupNameInfo(), Found.getLookupKind(), S, + &SS, Validator, LookupCtx, EnteringContext)) { + if (LookupCtx) { + bool DroppedSpecifier = + Corrected.WillReplaceSpecifier() && + Name.getAsString() == Corrected.getAsString(getLangOpts()); + if (DroppedSpecifier) + SS.clear(); + diagnoseTypo(Corrected, PDiag(diag::err_no_member_suggest) + << Name << LookupCtx << DroppedSpecifier + << SS.getRange()); + } else + diagnoseTypo(Corrected, PDiag(diag::err_undeclared_var_use_suggest) + << Name); + + if (NamedDecl *ND = Corrected.getCorrectionDecl()) Found.addDecl(ND); - } Found.setLookupName(Corrected.getCorrection()); } else { Found.setLookupName(&Identifier); @@ -658,7 +646,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // public: // void foo() { D::foo2(); } // }; - if (getLangOpts().MicrosoftExt) { + if (getLangOpts().MicrosoftMode) { DeclContext *DC = LookupCtx ? LookupCtx : CurContext; if (DC->isDependentContext() && DC->isFunctionOrMethod()) { SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); |