diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2020-01-14 12:34:00 +0100 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2020-01-14 17:00:33 +0100 |
| commit | 013c07f697886649b068cd97127e528b4fe7c03e (patch) | |
| tree | 711b34ee759bf96471cca91fd399ef6253bf85ad /clang/unittests/Tooling/Syntax/TreeTest.cpp | |
| parent | 9ef6faf49670e18eb1ba04105a7c70b450cdaa71 (diff) | |
| download | bcm5719-llvm-013c07f697886649b068cd97127e528b4fe7c03e.tar.gz bcm5719-llvm-013c07f697886649b068cd97127e528b4fe7c03e.zip | |
[Syntax] Unset IsOriginal flag on nodes removed from the tree
And add a corresponding test.
Only nodes inside the TranslationUnit subtree can be marked as original,
computeReplacements() relies on this.
Diffstat (limited to 'clang/unittests/Tooling/Syntax/TreeTest.cpp')
| -rw-r--r-- | clang/unittests/Tooling/Syntax/TreeTest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/Syntax/TreeTest.cpp b/clang/unittests/Tooling/Syntax/TreeTest.cpp index c457c788812..42d77d89353 100644 --- a/clang/unittests/Tooling/Syntax/TreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/TreeTest.cpp @@ -895,6 +895,9 @@ TEST_F(SyntaxTreeTest, Mutations) { auto *S = cast<syntax::Statement>(nodeByRange(Input.range(), TU)); ASSERT_TRUE(S->canModify()) << "cannot remove a statement"; syntax::removeStatement(*Arena, S); + EXPECT_TRUE(S->isDetached()); + EXPECT_FALSE(S->isOriginal()) + << "node removed from tree cannot be marked as original"; }; std::vector<std::pair<std::string /*Input*/, std::string /*Expected*/>> |

