summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2014-02-09 21:47:04 +0000
committerKaelyn Uhrain <rikka@google.com>2014-02-09 21:47:04 +0000
commit0e35355c04c9e44dab651a938bb7ee3572c37851 (patch)
tree2936243edefc50c1c155db41588e0414e21733ef /clang/lib/Sema/SemaLookup.cpp
parentd31aaf109efe98823e09594b3ffa9f63e09cf048 (diff)
downloadbcm5719-llvm-0e35355c04c9e44dab651a938bb7ee3572c37851.tar.gz
bcm5719-llvm-0e35355c04c9e44dab651a938bb7ee3572c37851.zip
PR18685: Ignore class template specializations as potential
nested-name-specifiers for typos unless the typo already has a nested-name-specifier that is a template specialization. llvm-svn: 201056
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 8a5c0a5ba7e..1a47340d69a 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -4210,6 +4210,12 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
KNI != KNIEnd; ++KNI)
Namespaces.AddNameSpecifier(KNI->first);
+ bool SSIsTemplate = false;
+ if (NestedNameSpecifier *NNS =
+ (SS && SS->isValid()) ? SS->getScopeRep() : 0) {
+ if (const Type *T = NNS->getAsType())
+ SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization;
+ }
for (ASTContext::type_iterator TI = Context.types_begin(),
TIEnd = Context.types_end();
TI != TIEnd; ++TI) {
@@ -4217,6 +4223,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
CD = CD->getCanonicalDecl();
if (!CD->isDependentType() && !CD->isAnonymousStructOrUnion() &&
!CD->isUnion() && CD->getIdentifier() &&
+ (SSIsTemplate || !isa<ClassTemplateSpecializationDecl>(CD)) &&
(CD->isBeingDefined() || CD->isCompleteDefinition()))
Namespaces.AddNameSpecifier(CD);
}
OpenPOWER on IntegriCloud