Author: tyker Date: Fri Jun 14 01:56:20 2019 New Revision: 363362 URL: http://llvm.org/viewvc/llvm-project?rev=363362&view=rev Log: [C++20] add Basic consteval specifier
Summary: this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration. Changes: - add the consteval keyword. - add parsing of consteval specifier for normal declarations and lambdas expressions. - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval. - adapt diagnostic about constexpr to print constexpr or consteval depending on the case. - add tests for basic semantic. Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: eraman, efriedma, rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61790 Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/trunk/source/Symbol/ClangASTContext.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=363362&r1=363361&r2=363362&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Fri Jun 14 01:56:20 2019 @@ -2127,7 +2127,7 @@ clang::NamedDecl *NameSearchContext::Add clang::FunctionDecl *func_decl = FunctionDecl::Create( *ast, context, SourceLocation(), SourceLocation(), decl_name, qual_type, nullptr, SC_Extern, isInlineSpecified, hasWrittenPrototype, - isConstexprSpecified); + isConstexprSpecified ? CSK_constexpr : CSK_unspecified); // We have to do more than just synthesize the FunctionDecl. We have to // synthesize ParmVarDecls for all of the FunctionDecl's arguments. To do Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=363362&r1=363361&r2=363362&view=diff ============================================================================== --- lldb/trunk/source/Symbol/ClangASTContext.cpp (original) +++ lldb/trunk/source/Symbol/ClangASTContext.cpp Fri Jun 14 01:56:20 2019 @@ -2170,7 +2170,7 @@ FunctionDecl *ClangASTContext::CreateFun *ast, decl_ctx, SourceLocation(), SourceLocation(), declarationName, ClangUtil::GetQualType(function_clang_type), nullptr, (clang::StorageClass)storage, is_inline, hasWrittenPrototype, - isConstexprSpecified); + isConstexprSpecified ? CSK_constexpr : CSK_unspecified); if (func_decl) decl_ctx->addDecl(func_decl); @@ -8210,7 +8210,7 @@ clang::CXXMethodDecl *ClangASTContext::A clang::SourceLocation()), method_qual_type, nullptr, // TypeSourceInfo * - explicit_spec, is_inline, is_artificial, false /*is_constexpr*/); + explicit_spec, is_inline, is_artificial, CSK_unspecified); cxx_method_decl = cxx_ctor_decl; } else { clang::StorageClass SC = is_static ? clang::SC_Static : clang::SC_None; @@ -8233,7 +8233,7 @@ clang::CXXMethodDecl *ClangASTContext::A clang::SourceLocation()), method_qual_type, nullptr, // TypeSourceInfo * - SC, is_inline, false /*is_constexpr*/, clang::SourceLocation()); + SC, is_inline, CSK_unspecified, clang::SourceLocation()); } else if (num_params == 0) { // Conversion operators don't take params... cxx_method_decl = clang::CXXConversionDecl::Create( @@ -8245,7 +8245,7 @@ clang::CXXMethodDecl *ClangASTContext::A clang::SourceLocation()), method_qual_type, nullptr, // TypeSourceInfo * - is_inline, explicit_spec, false /*is_constexpr*/, + is_inline, explicit_spec, CSK_unspecified, clang::SourceLocation()); } } @@ -8256,7 +8256,7 @@ clang::CXXMethodDecl *ClangASTContext::A clang::DeclarationNameInfo(decl_name, clang::SourceLocation()), method_qual_type, nullptr, // TypeSourceInfo * - SC, is_inline, false /*is_constexpr*/, clang::SourceLocation()); + SC, is_inline, CSK_unspecified, clang::SourceLocation()); } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits