From 9626b8d4ee5c7c80e6c3962f224fbe12689de975 Mon Sep 17 00:00:00 2001 From: Faisal Vali Date: Thu, 26 Apr 2018 00:42:40 +0000 Subject: [PATCH] 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! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330888 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/DeclTemplate.h | 40 ----- include/clang/AST/RecursiveASTVisitor.h | 7 - include/clang/Basic/DeclNodes.td | 1 - include/clang/Basic/DiagnosticParseKinds.td | 18 --- include/clang/Basic/DiagnosticSemaKinds.td | 35 ++-- include/clang/Basic/TemplateKinds.h | 6 +- include/clang/Parse/Parser.h | 16 +- include/clang/Sema/DeclSpec.h | 55 +------ include/clang/Sema/Sema.h | 15 -- include/clang/Serialization/ASTBitCodes.h | 3 - lib/AST/ASTDumper.cpp | 7 - lib/AST/DeclBase.cpp | 1 - lib/AST/DeclTemplate.cpp | 21 --- lib/CodeGen/CGDecl.cpp | 1 - lib/CodeGen/CodeGenModule.cpp | 1 - lib/Parse/ParseDecl.cpp | 22 +-- lib/Parse/ParseDeclCXX.cpp | 4 +- lib/Parse/ParseObjc.cpp | 4 +- lib/Parse/ParseTemplate.cpp | 170 ++------------------ lib/Parse/ParseTentative.cpp | 1 - lib/Parse/Parser.cpp | 6 +- lib/Sema/DeclSpec.cpp | 66 +------- lib/Sema/SemaDecl.cpp | 6 - lib/Sema/SemaDeclCXX.cpp | 2 +- lib/Sema/SemaTemplate.cpp | 76 +-------- lib/Sema/SemaTemplateInstantiateDecl.cpp | 5 - lib/Serialization/ASTCommon.cpp | 1 - lib/Serialization/ASTReaderDecl.cpp | 9 -- lib/Serialization/ASTWriter.cpp | 1 - lib/Serialization/ASTWriterDecl.cpp | 7 - test/Parser/cxx-concept-declaration.cpp | 7 + test/Parser/cxx2a-concept-declaration.cpp | 83 ---------- tools/libclang/CIndex.cpp | 1 - 33 files changed, 69 insertions(+), 629 deletions(-) create mode 100644 test/Parser/cxx-concept-declaration.cpp delete mode 100644 test/Parser/cxx2a-concept-declaration.cpp diff --git a/include/clang/AST/DeclTemplate.h b/include/clang/AST/DeclTemplate.h index 1fe95f4a59..9c68352e76 100644 --- a/include/clang/AST/DeclTemplate.h +++ b/include/clang/AST/DeclTemplate.h @@ -3015,46 +3015,6 @@ public: static bool classofKind(Kind K) { return K == VarTemplate; } }; -/// \brief Represents a C++2a ([temp] p1) concept-definition. -class ConceptDecl : public TemplateDecl { -protected: - Expr *ConstraintExpr; - - ConceptDecl(DeclContext *DC, - SourceLocation NameLoc, DeclarationName Name, - TemplateParameterList *Params, - Expr *ConstraintExpr) - : TemplateDecl(nullptr, Concept, DC, NameLoc, Name, Params), - ConstraintExpr(ConstraintExpr) {}; -public: - static ConceptDecl *Create(ASTContext &C, DeclContext *DC, - SourceLocation NameLoc, DeclarationName Name, - TemplateParameterList *Params, - Expr *ConstraintExpr); - static ConceptDecl *CreateDeserialized(ASTContext &C, unsigned ID); - - Expr *getConstraintExpr() const { - return ConstraintExpr; - } - - void setConstraintExpr(Expr *CE) { - ConstraintExpr = CE; - } - - SourceRange getSourceRange() const override LLVM_READONLY { - return SourceRange(getTemplateParameters()->getTemplateLoc(), - getConstraintExpr()->getLocEnd()); - } - - // Implement isa/cast/dyncast/etc. - static bool classof(const Decl *D) { return classofKind(D->getKind()); } - static bool classofKind(Kind K) { return K == Concept; } - - friend class ASTReader; - friend class ASTDeclReader; - friend class ASTDeclWriter; -}; - inline NamedDecl *getAsNamedDecl(TemplateParameter P) { if (auto *PD = P.dyn_cast()) return PD; diff --git a/include/clang/AST/RecursiveASTVisitor.h b/include/clang/AST/RecursiveASTVisitor.h index d9cc89b126..57641793f8 100644 --- a/include/clang/AST/RecursiveASTVisitor.h +++ b/include/clang/AST/RecursiveASTVisitor.h @@ -1722,13 +1722,6 @@ DEF_TRAVERSE_TMPL_DECL(Class) DEF_TRAVERSE_TMPL_DECL(Var) DEF_TRAVERSE_TMPL_DECL(Function) -DEF_TRAVERSE_DECL(ConceptDecl, { - TRY_TO(TraverseTemplateParameterListHelper(D->getTemplateParameters())); - TRY_TO(TraverseStmt(D->getConstraintExpr())); - // FIXME: Traverse all the concept specializations (once we implement forming - // template-ids with them). -}) - DEF_TRAVERSE_DECL(TemplateTemplateParmDecl, { // D is the "T" in something like // template