From: Haojian Wu Date: Thu, 16 Mar 2023 08:42:41 +0000 (+0100) Subject: [clang] Fix a UsingTemplate regression after 3e78fa860235431323aaf08c8fa922d75a7cfffa X-Git-Tag: upstream/17.0.6~14595 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1f5fdc22a26c46a11ce406b745291b3c03bc67e8;p=platform%2Fupstream%2Fllvm.git [clang] Fix a UsingTemplate regression after 3e78fa860235431323aaf08c8fa922d75a7cfffa TemplateName::getAsTemplateDecl() returns the underlying TemplateDecl for a UsingTemplate kind template name. We should respect that in the Profile method otherwise we might desugar the template name unexpectedly (e.g. for template argument deduction with deduciton guides). Differential Revision: https://reviews.llvm.org/D146202 --- diff --git a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp index 7dcbf47..68b6b21 100644 --- a/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp +++ b/clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp @@ -171,6 +171,13 @@ TEST(WalkAST, TemplateNames) { namespace ns {template struct S {}; } using ns::$explicit^S;)cpp", "^S x;"); + testWalk(R"cpp( + namespace ns { + template struct S { S(T);}; + template S(T t) -> S; + } + using ns::$explicit^S;)cpp", + "^S x(123);"); testWalk("template struct $explicit^S {};", R"cpp( template