[cfe-dev] to judge whether a function it is a C/C++ standard library function or not

Stephan Bergmann sbergman at redhat.com
Tue Jun 11 07:11:04 PDT 2013


On 06/11/2013 03:56 PM, Gábor Kozár wrote:
> The simplest is to check whether the function is in the std:: namespace
> - although this only works for C++ headers.

But note that user code can add certain template specializations to 
namespace std.

Stephan

> A better method might be to get the SourceLocation of the FunctionDecl
> (e.g. with getLocStart()) and then use SourceManager :: isInSystemHeader
> and isInExternCSystemHeader.
>
> Gabor
>
>
> 2013/6/11 Rambo <hunanlwm at sina.cn <mailto:hunanlwm at sina.cn>>
>
>     hello,everyone
>     I want to judge  whether a function it is a C/C++ standard library
>     function
>     or not,that is to say,I want to distinguish a function is a C/C++
>     standard
>     library function or written by users in his program.which clang API
>     can I
>     use? thank you!




More information about the cfe-dev mailing list