@@ -4509,22 +4509,14 @@ void StreamAPICallRule::runRule(const MatchFinder::MatchResult &Result) {
4509
4509
4510
4510
void KernelCallRefRule::registerMatcher (ast_matchers::MatchFinder &MF) {
4511
4511
4512
- auto cudaKernelNodeParamsMatcher = memberExpr (hasObjectExpression (hasType (
4513
- type (hasUnqualifiedDesugaredType (recordType (hasDeclaration (recordDecl (hasAnyName (" cudaKernelNodeParams" )))))))));
4514
4512
MF.addMatcher (
4515
- functionDecl (
4516
- forEachDescendant (
4517
- declRefExpr (
4518
- allOf (
4519
- to (functionDecl (hasAttr (attr::CUDAGlobal))),
4520
- unless (hasAncestor (cudaKernelCallExpr ()))
4521
- )
4522
- ).bind (" kernelRef" )
4523
- ),
4524
- unless (hasDescendant (cudaKernelNodeParamsMatcher))
4525
- ).bind (" outerFunc" ),
4526
- this );
4527
-
4513
+ functionDecl (
4514
+ forEachDescendant (
4515
+ declRefExpr (allOf (to (functionDecl (hasAttr (attr::CUDAGlobal))),
4516
+ unless (hasAncestor (cudaKernelCallExpr ()))))
4517
+ .bind (" kernelRef" )))
4518
+ .bind (" outerFunc" ),
4519
+ this );
4528
4520
4529
4521
MF.addMatcher (unresolvedLookupExpr (unless (hasAncestor (cudaKernelCallExpr ())))
4530
4522
.bind (" unresolvedRef" ),
@@ -4573,13 +4565,11 @@ void KernelCallRefRule::insertWrapperPostfix(const T *Node,
4573
4565
bool isInsertWrapperRegister) {
4574
4566
auto NLoc = DpctGlobalInfo::getSourceManager ().getSpellingLoc (
4575
4567
Node->getNameInfo ().getBeginLoc ());
4576
- std::cout << " Inserting _wrapper at location: " << NLoc.printToString (DpctGlobalInfo::getSourceManager ()) << " \n " ;
4577
4568
emplaceTransformation (new InsertText (
4578
4569
NLoc.getLocWithOffset (Node->getNameInfo ().getAsString ().length ()),
4579
4570
" _wrapper" ));
4580
4571
4581
4572
if (!isInsertWrapperRegister) {
4582
- std::cout << " Not inserting wrapper_register\n " ;
4583
4573
return ;
4584
4574
}
4585
4575
const Expr *E = Node;
@@ -4595,7 +4585,6 @@ void KernelCallRefRule::insertWrapperPostfix(const T *Node,
4595
4585
E = COC;
4596
4586
}
4597
4587
}
4598
- std::cout << " Inserting wrapper_register with TypeRepl: " << TypeRepl << " \n " ;
4599
4588
emplaceTransformation (new InsertBeforeStmt (
4600
4589
E, MapNames::getDpctNamespace () + " wrapper_register" + TypeRepl + " (" ));
4601
4590
emplaceTransformation (new InsertAfterStmt (E, " ).get()" ));
@@ -4604,7 +4593,6 @@ void KernelCallRefRule::insertWrapperPostfix(const T *Node,
4604
4593
void KernelCallRefRule::runRule (
4605
4594
const ast_matchers::MatchFinder::MatchResult &Result) {
4606
4595
if (auto DRE = getAssistNodeAsType<DeclRefExpr>(Result, " kernelRef" )) {
4607
- std::cout << " KernelRef matched\n " ;
4608
4596
const FunctionDecl *OuterFD =
4609
4597
getAssistNodeAsType<FunctionDecl>(Result, " outerFunc" );
4610
4598
if (!OuterFD) {
@@ -7179,23 +7167,13 @@ TextModification *
7179
7167
ReplaceMemberAssignAsSetMethod (const Expr *E, const MemberExpr *ME,
7180
7168
StringRef MethodName, StringRef ReplacedArg,
7181
7169
StringRef ExtraArg, StringRef ExtraFeild) {
7182
- std::cout << " Entering ReplaceMemberAssignAsSetMethod (overloaded)\n " ;
7183
- std::cout << " Expr: " << E->getStmtClassName () << " \n " ;
7184
- std::cout << " MemberExpr: " << ME->getMemberNameInfo ().getAsString () << " \n " ;
7185
- std::cout << " MethodName: " << MethodName.str () << " \n " ;
7186
- std::cout << " ReplacedArg: " << ReplacedArg.str () << " \n " ;
7187
- std::cout << " ExtraArg: " << ExtraArg.str () << " \n " ;
7188
- std::cout << " ExtraFeild: " << ExtraFeild.str () << " \n " ;
7189
7170
if (ReplacedArg.empty ()) {
7190
7171
if (auto RHS = getRhs (E)) {
7191
- std::cout << " RHS found: " << ExprAnalysis::ref (RHS) << " \n " ;
7192
- StringRef c = ExprAnalysis::ref (RHS);
7193
7172
return ReplaceMemberAssignAsSetMethod (
7194
7173
getStmtExpansionSourceRange (E).getEnd (), ME, MethodName,
7195
7174
ExprAnalysis::ref (RHS), ExtraArg, ExtraFeild);
7196
7175
}
7197
7176
}
7198
- std::cout << " ReplacedArg is not empty or RHS not found\n " ;
7199
7177
return ReplaceMemberAssignAsSetMethod (getStmtExpansionSourceRange (E).getEnd (),
7200
7178
ME, MethodName, ReplacedArg, ExtraArg);
7201
7179
}
0 commit comments