//===- TemplateArgumentLocTraverser.cpp -----------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "TestVisitor.h" using namespace clang; namespace { class TemplateArgumentLocTraverser : public ExpectedLocationVisitor { public: bool TraverseTemplateArgumentLoc(const TemplateArgumentLoc &ArgLoc) override { std::string ArgStr; llvm::raw_string_ostream Stream(ArgStr); const TemplateArgument &Arg = ArgLoc.getArgument(); Arg.print(Context->getPrintingPolicy(), Stream, /*IncludeType*/ true); Match(ArgStr, ArgLoc.getLocation()); return ExpectedLocationVisitor::TraverseTemplateArgumentLoc(ArgLoc); } }; TEST(RecursiveASTVisitor, VisitsClassTemplateTemplateParmDefaultArgument) { TemplateArgumentLocTraverser Visitor; Visitor.ExpectMatch("X", 2, 40); EXPECT_TRUE(Visitor.runOver( "template class X;\n" "template