I’m writing a small program with clang library to find function call in any C++ code.
It’s work well on user defined function.
But it’s not work if C++ code call the built-in STL function.
This is an example C++ code
I want to visit for_each() function call
This is just a guess, but did you try actually using the 'std' namespace? The code you've posted doesn't even compile (even if I put something in the "...") unless I say 'std::vector'.
The call to std::for_each should definitely show up as a CallExpr.
In fact, I shorten the example C++ code to easy reading : )
The full code, I have "using namespace std;", as well.
So I try with full call "std::for_each", too. But it's still not work.
But.. Good new, I try to change the clang environment to MinGW32 instead of MSVC2010.
It's work !!
1. I newly compile clang library with MinGW32
2. My program is compile with MinGW32. (C++ header come from MinGW32)
3. OS is the same = Windows 7 x64
4. My program is unmodified !
Now, my program can visit STL function call : )
I don't know the reason.
But I guess that there are some of special syntax in MSVC2010 STL header that clang can not understand ?