From: Eduardo Caldas Date: Mon, 24 Aug 2020 10:07:27 +0000 (+0000) Subject: [SyntaxTree] Split FreeStandingClass tests X-Git-Tag: llvmorg-13-init~13919 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4093d663f8377b3ca3746ff104c83c9c5510c0a;p=platform%2Fupstream%2Fllvm.git [SyntaxTree] Split FreeStandingClass tests Differential Revision: https://reviews.llvm.org/D86440 --- diff --git a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp index 93f510e..8dbf99c 100644 --- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp @@ -2515,55 +2515,65 @@ UsingDeclaration )txt"})); } -TEST_P(SyntaxTreeTest, FreeStandingClasses) { - // Free-standing classes, must live inside a SimpleDeclaration. - EXPECT_TRUE(treeDumpEqual( +TEST_P(SyntaxTreeTest, FreeStandingClass_ForwardDeclaration) { + EXPECT_TRUE(treeDumpEqualOnAnnotations( R"cpp( -struct X; -struct X {}; - -struct Y *y1; -struct Y {} *y2; +[[struct X;]] +[[struct Y *y1;]] +)cpp", + {R"txt( +SimpleDeclaration +|-struct +|-X +`-; +)txt", + R"txt( +SimpleDeclaration +|-struct +|-Y +|-SimpleDeclarator +| |-* +| `-y1 +`-; +)txt"})); +} -struct {} *a1; +TEST_P(SyntaxTreeTest, FreeStandingClasses_Definition) { + EXPECT_TRUE(treeDumpEqualOnAnnotations( + R"cpp( +[[struct X {};]] +[[struct Y {} *y2;]] +[[struct {} *a1;]] )cpp", - R"txt( -*: TranslationUnit -|-SimpleDeclaration -| |-struct -| |-X -| `-; -|-SimpleDeclaration -| |-struct -| |-X -| |-{ -| |-} -| `-; -|-SimpleDeclaration -| |-struct -| |-Y -| |-SimpleDeclarator -| | |-* -| | `-y1 -| `-; -|-SimpleDeclaration -| |-struct -| |-Y -| |-{ -| |-} -| |-SimpleDeclarator -| | |-* -| | `-y2 -| `-; -`-SimpleDeclaration - |-struct - |-{ - |-} - |-SimpleDeclarator - | |-* - | `-a1 - `-; -)txt")); + {R"txt( +SimpleDeclaration +|-struct +|-X +|-{ +|-} +`-; +)txt", + R"txt( +SimpleDeclaration +|-struct +|-Y +|-{ +|-} +|-SimpleDeclarator +| |-* +| `-y2 +`-; +)txt", + R"txt( +SimpleDeclaration +|-struct +|-{ +|-} +|-SimpleDeclarator +| |-* +| `-a1 +`-; +)txt"})); } TEST_P(SyntaxTreeTest, StaticMemberFunction) {