From 013c07f697886649b068cd97127e528b4fe7c03e Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Tue, 14 Jan 2020 12:34:00 +0100 Subject: [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. --- clang/unittests/Tooling/Syntax/TreeTest.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/unittests/Tooling/Syntax/TreeTest.cpp') 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(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> -- cgit v1.2.3