53 auto match_template_special_decl =
54 classTemplateSpecializationDecl(
55 cxxRecordDecl(forEachDescendant(fieldDecl(
57 ).bind(
"special_template_decl");
59 auto match_template_decl =
61 has(cxxRecordDecl(forEachDescendant(
74 ).bind(
"template_decl");
77 finder.addMatcher(match_template_decl,
this);
78 finder.addMatcher(match_template_special_decl,
this);
81 virtual void run(
const MatchFinder::MatchResult &result) {
86 auto fd_arg{result.Nodes.getNodeAs<FieldDecl>(
"fd_arg")};
87 auto fd_parm{result.Nodes.getNodeAs<FieldDecl>(
"fd_parm")};
89 auto record_type{result.Nodes.getNodeAs<RecordType>(
"record_type")};
90 auto parm_type{result.Nodes.getNodeAs<TemplateTypeParmType>(
"parm_type")};
91 auto template_special{result.Nodes.getNodeAs<TemplateSpecializationType>(
92 "specialization_type")};
93 LLVM_DEBUG(llvm::dbgs()
94 <<
"=============== TEST Template Parm Matcher ====== \n");
97 LLVM_DEBUG(llvm::dbgs() <<
"Found a Arg FieldDecl\n");
98 fd_arg->dump(llvm::errs());
99 fd_arg->getType().getTypePtr()->dump();
104 LLVM_DEBUG(llvm::dbgs() <<
"Found a Parm FieldDecl\n");
105 fd_parm->dump(llvm::errs());
106 fd_parm->getType().getTypePtr()->dump();