diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2020-01-14 16:27:06 +0100 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2020-01-14 16:41:09 +0100 |
| commit | 07a41018e9d27f67f7b4295eb7e00e0345c0aacf (patch) | |
| tree | 04639b8d6f393da8f548a908e8f56a7c22af5025 /clang/unittests/Tooling/Syntax/TreeTest.cpp | |
| parent | 3b929fe7763570fc1d4a4691a53257a4a0b7760e (diff) | |
| download | bcm5719-llvm-07a41018e9d27f67f7b4295eb7e00e0345c0aacf.tar.gz bcm5719-llvm-07a41018e9d27f67f7b4295eb7e00e0345c0aacf.zip | |
[Syntax] Mark synthesized nodes as modifiable
This was an oversight in the original patch.
Also add corresponding tests.
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TreeTest.cpp')
| -rw-r--r-- | clang/unittests/Tooling/Syntax/TreeTest.cpp | 18 |
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 |

