__builtin in clang?

Hi,
  I am writing a rewriting program. In order to search for appropriate paths
(default c++ paths), I added headersearchoptions to the preprocessor and
included all the default include paths clang++ uses. I am able to find all
types. The only error that is occurring is when the program encounters
functions similar to "__builtin_expect". It is unable to find these
functions in any files. Some more examples of similar functions are
"__builtin_alloca" and "__builtin_strcmp". Does clang support these
functions? If yes, where are their definitions located?

Regards,
Adil

Hi,
  I am writing a rewriting program. In order to search for appropriate paths
(default c++ paths), I added headersearchoptions to the preprocessor and
included all the default include paths clang++ uses.

Since you'll need to reproduce exactly how the source to your project
was compiled at some point anyway, you might want to consider using
the Tooling infrastructure ( http://clang.llvm.org/docs/Tooling.html )
which should simplify this task/make it easy for your rewriter to
correctly analyze the target source code.

Hi,
I will take a look at tooling. But since I have already done a lot of work this way and might need to use clang again for a while, I thought it would be best if I knew as much as possible. Is it not possible to make it work this way?

P.S. The new documentation site looks great.

Regards,
Adil

You can use FunctionDecl::getBuiltinID() to check for builtin functions (it returns NotBuiltin for normal functions), or perhaps Decl::isImplicit() to see if the function was generated by the compiler. (You may end up having to use both.)

Jordan