summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/Syntax/TreeTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TreeTest.cpp')
-rw-r--r--clang/unittests/Tooling/Syntax/TreeTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp
index b54d06319e8..c457c788812 100644
--- a/clang/unittests/Tooling/Syntax/TreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp
@@ -11,6 +11,7 @@
#include "clang/AST/Decl.h"
#include "clang/AST/Stmt.h"
#include "clang/Basic/LLVM.h"
+#include "clang/Basic/TokenKinds.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
#include "clang/Frontend/FrontendAction.h"
@@ -906,4 +907,21 @@ TEST_F(SyntaxTreeTest, Mutations) {
CheckTransformation(C.first, C.second, RemoveStatement);
}
+TEST_F(SyntaxTreeTest, SynthesizedNodes) {
+ buildTree("");
+
+ auto *C = syntax::createPunctuation(*Arena, tok::comma);
+ ASSERT_NE(C, nullptr);
+ EXPECT_EQ(C->token()->kind(), tok::comma);
+ EXPECT_TRUE(C->canModify());
+ EXPECT_FALSE(C->isOriginal());
+ EXPECT_TRUE(C->isDetached());
+
+ auto *S = syntax::createEmptyStatement(*Arena);
+ ASSERT_NE(S, nullptr);
+ EXPECT_TRUE(S->canModify());
+ EXPECT_FALSE(S->isOriginal());
+ EXPECT_TRUE(S->isDetached());
+}
+
} // namespace
OpenPOWER on IntegriCloud