Dear All,
I want to retrieve all assignment operator from a given C program. Can anyone please inform me how to do it?Thanks in advance:-) .
Dear All,
I want to retrieve all assignment operator from a given C program. Can anyone please inform me how to do it?Thanks in advance:-) .
Hi!
ASTMatchers ( http://clang.llvm.org/docs/LibASTMatchersReference.html ) are probably what you’re looking for. If you’d like examples, clang-tidy’s SimplifyBooleanExprCheck seems to create ASTMatchers for assignment operations.
Readding cfe-dev.
I’m not at all familiar with the Rewriter APIs, so I could be wrong, but ISTM that Rewriter::InsertTextAfter(Loc, Str)
will insert text at Loc (after any other text that was previously inserted at Loc). It also looks like bo->getLocEnd()
will not return the location of “;” in “foo = bar;”. So, it makes sense that things end up a bit off.
Have you tried using InsertTextAfterToken
instead? It looks like that may do what you want.