nridge created this revision. Herald added subscribers: usaxena95, kadircet, arphaman. nridge requested review of this revision. Herald added projects: clang, clang-tools-extra. Herald added a subscriber: cfe-commits.
Now that consteval and constinit are possible values, 1 bit is no longer enough. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D111971 Files: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp clang/lib/Serialization/ASTWriterDecl.cpp Index: clang/lib/Serialization/ASTWriterDecl.cpp =================================================================== --- clang/lib/Serialization/ASTWriterDecl.cpp +++ clang/lib/Serialization/ASTWriterDecl.cpp @@ -2260,7 +2260,7 @@ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero - Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Constexpr Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp +++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp @@ -672,6 +672,24 @@ ElementsAre(AllOf(Diag(Test.range(), "'main' must return 'int'"), Not(WithFix(_))))); } +TEST(DiagnosticsTest, Consteval) { + Annotations Header(R"cpp( + struct Container { + consteval Container() { + Push(); + } + consteval void Push() {} + }; + )cpp"); + Annotations Main(R"cpp( + #include "a.h" + constexpr Container c = Container(); + )cpp"); + TestTU TU = TestTU::withCode(Main.code()); + TU.ExtraArgs.push_back("-std=c++20"); + TU.AdditionalFiles = {{"a.h", std::string(Header.code())}}; + EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty()); +} TEST(ClangdTest, MSAsm) { // Parsing MS assembly tries to use the target MCAsmInfo, which we don't link.
Index: clang/lib/Serialization/ASTWriterDecl.cpp =================================================================== --- clang/lib/Serialization/ASTWriterDecl.cpp +++ clang/lib/Serialization/ASTWriterDecl.cpp @@ -2260,7 +2260,7 @@ Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero - Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr + Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Constexpr Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp =================================================================== --- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp +++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp @@ -672,6 +672,24 @@ ElementsAre(AllOf(Diag(Test.range(), "'main' must return 'int'"), Not(WithFix(_))))); } +TEST(DiagnosticsTest, Consteval) { + Annotations Header(R"cpp( + struct Container { + consteval Container() { + Push(); + } + consteval void Push() {} + }; + )cpp"); + Annotations Main(R"cpp( + #include "a.h" + constexpr Container c = Container(); + )cpp"); + TestTU TU = TestTU::withCode(Main.code()); + TU.ExtraArgs.push_back("-std=c++20"); + TU.AdditionalFiles = {{"a.h", std::string(Header.code())}}; + EXPECT_THAT(*TU.build().getDiagnostics(), IsEmpty()); +} TEST(ClangdTest, MSAsm) { // Parsing MS assembly tries to use the target MCAsmInfo, which we don't link.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits