diff options
author | Matt Morehouse <mascasa@google.com> | 2020-11-03 11:48:07 -0800 |
---|---|---|
committer | Matt Morehouse <mascasa@google.com> | 2020-11-03 13:57:31 -0800 |
commit | 72531ae6e64d4408f6e9aee8d5902f5d6b0ae519 (patch) | |
tree | b79d299665da391cc32dda5b17cfd469dbb1a0d1 /clang/unittests/Tooling/TransformerTest.cpp | |
parent | d2c45f66204552177b164095501d560cd950a690 (diff) | |
download | llvm-72531ae6e64d4408f6e9aee8d5902f5d6b0ae519.zip llvm-72531ae6e64d4408f6e9aee8d5902f5d6b0ae519.tar.gz llvm-72531ae6e64d4408f6e9aee8d5902f5d6b0ae519.tar.bz2 |
Revert "Ignore template instantiations if not in AsIs mode"
This reverts commit 53df3beb624989ed32d87697d0c17601d7871465 due to
check-asan failure on the buildbot.
Diffstat (limited to 'clang/unittests/Tooling/TransformerTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/TransformerTest.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/clang/unittests/Tooling/TransformerTest.cpp b/clang/unittests/Tooling/TransformerTest.cpp index 1f06374..58405e1 100644 --- a/clang/unittests/Tooling/TransformerTest.cpp +++ b/clang/unittests/Tooling/TransformerTest.cpp @@ -1067,70 +1067,6 @@ TEST_F(TransformerTest, ErrorOccurredMatchSkipped) { EXPECT_EQ(ErrorCount, 0); } -TEST_F(TransformerTest, TemplateInstantiation) { - - std::string NonTemplatesInput = R"cpp( -struct S { - int m_i; -}; -)cpp"; - std::string NonTemplatesExpected = R"cpp( -struct S { - safe_int m_i; -}; -)cpp"; - - std::string TemplatesInput = R"cpp( -template<typename T> -struct TemplStruct { - TemplStruct() {} - ~TemplStruct() {} - -private: - T m_t; -}; - -void instantiate() -{ - TemplStruct<int> ti; -} -)cpp"; - - auto MatchedField = fieldDecl(hasType(asString("int"))).bind("theField"); - - // Changes the 'int' in 'S', but not the 'T' in 'TemplStruct': - testRule(makeRule(traverse(TK_IgnoreUnlessSpelledInSource, MatchedField), - changeTo(cat("safe_int ", name("theField")))), - NonTemplatesInput + TemplatesInput, - NonTemplatesExpected + TemplatesInput); - - // In AsIs mode, template instantiations are modified, which is - // often not desired: - - std::string IncorrectTemplatesExpected = R"cpp( -template<typename T> -struct TemplStruct { - TemplStruct() {} - ~TemplStruct() {} - -private: - safe_int m_t; -}; - -void instantiate() -{ - TemplStruct<int> ti; -} -)cpp"; - - // Changes the 'int' in 'S', and (incorrectly) the 'T' in 'TemplStruct': - testRule(makeRule(traverse(TK_AsIs, MatchedField), - changeTo(cat("safe_int ", name("theField")))), - - NonTemplatesInput + TemplatesInput, - NonTemplatesExpected + IncorrectTemplatesExpected); -} - // Transformation of macro source text when the change encompasses the entirety // of the expanded text. TEST_F(TransformerTest, SimpleMacro) { |