diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-01-30 20:39:26 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-01-30 20:39:26 +0000 |
| commit | ee57984c111bccc8fd809b2a9f43a4db21b6d66e (patch) | |
| tree | db292ba1395232b042b5b9c4fe3d1ee4d9eb97e2 /clang/lib/Sema/SemaDecl.cpp | |
| parent | cd79d0f5f36332bcc9ad5c70c314dcbad4f8886d (diff) | |
| download | bcm5719-llvm-ee57984c111bccc8fd809b2a9f43a4db21b6d66e.tar.gz bcm5719-llvm-ee57984c111bccc8fd809b2a9f43a4db21b6d66e.zip | |
Towards P0091R3: parsing support for class template argument deduction in typename-specifiers.
This reinstates r293455, reverted in r293455, with a fix for cv-qualifier
handling on dependent typename-specifiers.
llvm-svn: 293544
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index ce843a587b7..60daae056b3 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -60,11 +60,6 @@ Sema::DeclGroupPtrTy Sema::ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType) { return DeclGroupPtrTy::make(DeclGroupRef(Ptr)); } -static bool isTypeTemplate(NamedDecl *ND) { - return isa<ClassTemplateDecl>(ND) || isa<TypeAliasTemplateDecl>(ND) || - isa<TemplateTemplateParmDecl>(ND); -} - namespace { class TypeNameValidatorCCC : public CorrectionCandidateCallback { @@ -81,7 +76,7 @@ class TypeNameValidatorCCC : public CorrectionCandidateCallback { bool ValidateCandidate(const TypoCorrection &candidate) override { if (NamedDecl *ND = candidate.getCorrectionDecl()) { bool IsType = isa<TypeDecl>(ND) || isa<ObjCInterfaceDecl>(ND); - bool AllowedTemplate = AllowTemplates && isTypeTemplate(ND); + bool AllowedTemplate = AllowTemplates && getAsTypeTemplateDecl(ND); return (IsType || AllowedTemplate) && (AllowInvalidDecl || !ND->isInvalidDecl()); } @@ -405,7 +400,7 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, for (LookupResult::iterator Res = Result.begin(), ResEnd = Result.end(); Res != ResEnd; ++Res) { if (isa<TypeDecl>(*Res) || isa<ObjCInterfaceDecl>(*Res) || - (AllowDeducedTemplate && isTypeTemplate(*Res))) { + (AllowDeducedTemplate && getAsTypeTemplateDecl(*Res))) { if (!IIDecl || (*Res)->getLocation().getRawEncoding() < IIDecl->getLocation().getRawEncoding()) @@ -458,9 +453,10 @@ ParsedType Sema::getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, (void)DiagnoseUseOfDecl(IDecl, NameLoc); if (!HasTrailingDot) T = Context.getObjCInterfaceType(IDecl); - } else if (AllowDeducedTemplate && isTypeTemplate(IIDecl)) { - T = Context.getDeducedTemplateSpecializationType( - TemplateName(cast<TemplateDecl>(IIDecl)), QualType(), false); + } else if (AllowDeducedTemplate) { + if (auto *TD = getAsTypeTemplateDecl(IIDecl)) + T = Context.getDeducedTemplateSpecializationType(TemplateName(TD), + QualType(), false); } if (T.isNull()) { |

