diff options
author | Faisal Vali <faisalv@yahoo.com> | 2018-04-26 00:42:40 +0000 |
---|---|---|
committer | Faisal Vali <faisalv@yahoo.com> | 2018-04-26 00:42:40 +0000 |
commit | a534f07f8c790c6a2244a183aed4b38d5485236a (patch) | |
tree | a7bbb3f0c0cb2b72acb826b795aad38a8fa79d5c /clang/lib/Sema/SemaTemplate.cpp | |
parent | 563296abd8a1b2a9f2cd6675094ea448d0adbf1f (diff) | |
download | bcm5719-llvm-a534f07f8c790c6a2244a183aed4b38d5485236a.tar.gz bcm5719-llvm-a534f07f8c790c6a2244a183aed4b38d5485236a.zip |
Revert rC330794 and some dependent tiny bug fixes
See Richard's humbling feedback here:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html
Wish I'd had the patience to solicit the feedback prior to committing :)
Sorry for the noise guys.
Thank you Richard for being the steward that clang deserves!
llvm-svn: 330888
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 76 |
1 files changed, 3 insertions, 73 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index f3cb04ac6a9..190dd0721fd 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -232,11 +232,9 @@ TemplateNameKind Sema::isTemplateName(Scope *S, } else { assert(isa<ClassTemplateDecl>(TD) || isa<TemplateTemplateParmDecl>(TD) || isa<TypeAliasTemplateDecl>(TD) || isa<VarTemplateDecl>(TD) || - isa<BuiltinTemplateDecl>(TD) || isa<ConceptDecl>(TD)); + isa<BuiltinTemplateDecl>(TD)); TemplateKind = - isa<VarTemplateDecl>(TD) ? TNK_Var_template : - isa<ConceptDecl>(TD) ? TNK_Concept_template : - TNK_Type_template; + isa<VarTemplateDecl>(TD) ? TNK_Var_template : TNK_Type_template; } } @@ -3036,8 +3034,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name, TemplateDecl *Template = Name.getAsTemplateDecl(); if (!Template || isa<FunctionTemplateDecl>(Template) || - isa<VarTemplateDecl>(Template) || - isa<ConceptDecl>(Template)) { + isa<VarTemplateDecl>(Template)) { // We might have a substituted template template parameter pack. If so, // build a template specialization type for it. if (Name.getAsSubstTemplateTemplateParmPack()) @@ -3991,18 +3988,6 @@ Sema::CheckVarTemplateId(const CXXScopeSpec &SS, /*FoundD=*/nullptr, TemplateArgs); } -ExprResult -Sema::CheckConceptTemplateId(const CXXScopeSpec &SS, - const DeclarationNameInfo &NameInfo, - ConceptDecl *Template, - SourceLocation TemplateLoc, - const TemplateArgumentListInfo *TemplateArgs) { - // TODO: Do concept specialization here. - Diag(Template->getLocation(), diag::err_concept_feature_unimplemented) - << "can not form concept template-id"; - return ExprError(); -} - ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, @@ -7713,61 +7698,6 @@ Decl *Sema::ActOnTemplateDeclarator(Scope *S, return NewDecl; } -ConceptDecl *Sema::ActOnConceptDefinition(Scope *S, - MultiTemplateParamsArg TemplateParameterLists, IdentifierInfo *Name, - SourceLocation NameLoc, Expr *ConstraintExpr) { - // C++2a [temp.concept]p3: - // A concept-definition shall appear in the global scope or in a namespace - // scope. - assert( - CurContext->isFileContext() && - "We check during parsing that 'concept's only occur at namespace scope"); - - // Forbid any prior declaration of this name within the current namespace. - LookupResult Previous(*this, - DeclarationNameInfo(DeclarationName(Name), NameLoc), - LookupOrdinaryName); - LookupName(Previous, S); - if (!Previous.empty()) { - const NamedDecl *PrevDecl = Previous.getRepresentativeDecl(); - if (PrevDecl->getDeclContext()->Equals(CurContext)) { - if (Previous.isSingleResult() && - isa<ConceptDecl>(Previous.getFoundDecl())) { - Diag(NameLoc, diag::err_redefinition) << Name; - } else { - Diag(NameLoc, diag::err_redefinition_different_kind) << Name; - } - Diag(PrevDecl->getLocation(), diag::note_previous_decl) << PrevDecl; - return nullptr; - } - } - - ConceptDecl *NewDecl = ConceptDecl::Create(Context, CurContext, NameLoc, - Name, TemplateParameterLists[0], - ConstraintExpr); - - if (!NewDecl) - return nullptr; - - if (NewDecl->getAssociatedConstraints()) { - // C++2a [temp.concept]p4: - // A concept shall not have associated constraints. - // TODO: Make a test once we have actual associated constraints. - Diag(NameLoc, diag::err_concept_no_associated_constraints); - NewDecl->setInvalidDecl(); - } - - assert((S->isTemplateParamScope() || !TemplateParameterLists[0]->size()) && - "Not in template param scope?"); - assert(S->getParent() && !S->getParent()->isTemplateParamScope() && - "Parent scope should exist and not be template parameter."); - - ActOnDocumentableDecl(NewDecl); - PushOnScopeChains(NewDecl, S->getParent(), /*AddToContext=*/true); - - return NewDecl; -} - /// \brief Strips various properties off an implicit instantiation /// that has just been explicitly specialized. static void StripImplicitInstantiation(NamedDecl *D) { |