<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>Hi all,</div><div><br></div><div>i have a question. This Code finds all For-Loop in a Cpp-File and gives LIKWID_MARKER_START(); and LIKWID_MARKER_STOP(); as output. </div>
<div><br>Now i want to search inside a for loop for nested for loops if this will find a nested forloop i dont want to set the text.</div>
<div><br></div><div>i just want to set the text in the outer for loop, not the inner for loop.</div><div><br></div><div>How i can do that in clang?</div><div><br></div><div><br></div><div><div> bool VisitStmt(Stmt *s) {</div>
<div>
<br></div><div> if (isa<ForStmt>(s))</div><div> { </div><div> </div><div> ForStmt *ForStatement = cast<ForStmt>(s);</div><div> SourceLocation ST = ForStatement->getSourceRange().getBegin();</div>
<div> stringstream SSBefore;</div><div> SSBefore << "LIKWID_MARKER_START();\n";</div><div> </div><div> TheRewriter.InsertText(ST, SSBefore.str(), true, true);</div><div> </div>
<div> stringstream SSAfter;</div><div> ST = ForStatement->getLocEnd().getLocWithOffset(1);</div><div> SSAfter << "\nLIKWID_MARKER_STOP();";</div><div> </div>
<div>
TheRewriter.InsertText(ST, SSAfter.str(), true, true); </div><div> }</div><div><br></div><div> }<br></div></div><div><br></div><div>Bye </div><span class="HOEnZb"><font color="#888888"><div>Anja</div>
</font></span></div>
</div><br></div>