<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Tahoma'; COLOR: #000047; FONT-SIZE: 10pt">
<DIV>I’m writing a small program with clang library to find function call in any 
C++ code.</DIV>
<DIV>It’s work well on user defined function.</DIV>
<DIV>But it’s not work if C++ code call the built-in STL function.</DIV>
<DIV> </DIV>
<DIV>This is an example C++ code</DIV>
<DIV>I want to visit for_each() function call</DIV>
<DIV>--------------------------------------</DIV>
<DIV>#include <vector></DIV>
<DIV>#include <algorithm></DIV>
<DIV> </DIV>
<DIV>int main() {</DIV>
<DIV>    vector<int> my_vector;</DIV>
<DIV>    for_each(my_vector.begin(), my_vector.end(), ...);</DIV>
<DIV>    return 0;</DIV>
<DIV>}</DIV>
<DIV>--------------------------------------</DIV>
<DIV> </DIV>
<DIV>This is my clang’s AST consumer class</DIV>
<DIV>--------------------------------------</DIV>
<DIV>class MyASTConsumer :</DIV>
<DIV>    public ASTConsumer,</DIV>
<DIV>    public RecursiveASTVisitor<MyASTConsumer> {</DIV>
<DIV>    </DIV>
<DIV>    void HandleTranslationUnit(ASTContext &Ctx) {</DIV>
<DIV>        
TraverseDecl(Ctx.getTranslationUnitDecl());</DIV>
<DIV>    }</DIV>
<DIV> </DIV>
<DIV>    bool VisitCallExpr(CallExpr *E) {</DIV>
<DIV>        E->dump(); // just print this 
function call to screen</DIV>
<DIV>        return true;</DIV>
<DIV>    }</DIV>
<DIV>}</DIV>
<DIV>--------------------------------------</DIV>
<DIV> </DIV>
<DIV>I’ve checked my program that</DIV>
<DIV>- User defined function call is work well.</DIV>
<DIV>- Standard C function call is work well. (such as printf(), time(), abs(), 
...)</DIV>
<DIV>- STL function call is NOT work.</DIV>
<DIV>- My clang have successfully detected the included STL header. (I’ve 
checked by printing function declaration such as for_each(), find_if(), swap(), 
...)</DIV>
<DIV> </DIV>
<DIV>My clang environment are</DIV>
<DIV>- Clang library 3.1 complied with MSVC 2010.</DIV>
<DIV>- My program is written on MSVC 2010. (STL header is MSVC 2010)</DIV>
<DIV>- My computer is Windows 7 x64</DIV>
<DIV> </DIV>
<DIV>Thank you for any suggestions.</DIV>
<DIV> </DIV></DIV></DIV></BODY></HTML>