[cfe-dev] First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'

Eli Friedman eli.friedman at gmail.com
Tue Sep 14 22:41:25 PDT 2010


2010/9/13 Francis Gagné <fragag at hotmail.com>:
>
>> Date: Mon, 13 Sep 2010 18:36:59 -0700
>> Subject: Re: [cfe-dev] First steps with Clang; unknown builtins '__builtin_va_start' and '__builtin_va_end'
>> From: eli.friedman at gmail.com
>> To: fragag at hotmail.com
>> CC: cfe-dev at cs.uiuc.edu
>>
>> 2010/9/13 Francis Gagné :
>>>
>>> Hello,
>>>
>>> I am currently working on some libraries written in C, for which I am writing documentation in an external XML document (using a custom schema), and I would like to use the Clang libraries to check that my documentation is up-to-date (i.e. that all functions/types/members are documented, and that all documented items are still present in the source code.
>>>
>>> I started writing some code a bit at random, because the best source of documentation on Clang I could find is the Doxygen documentation, which is not really useful when I don't know what classes or functions I am supposed to use. This is my first experience with Clang, so I'm a bit lost. The following snippet has main0, my first attempt, and main, my second attempt.
>>>
>>> http://pastebin.com/T494mbmD
>>>
>>> Currently, both fail with the same errors:
>>>
>>> c:/mingw/include/stdio.h:245:35: error: use of unknown builtin '__builtin_va_start'
>>> __builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
>>> ^
>>> c:/mingw/include/stdio.h:247:3: error: use of unknown builtin '__builtin_va_end'
>>> __builtin_va_end( __local_argv );
>>> ^
>>
>> Have you tried following the example in examples/clang-interpreter/ in
>> the source tree? Getting all the setup code exactly right can be
>> tricky...
>>
>> -Eli
>
> This is using the Driver library, which seems to simplify a lot of the work. I thought I would take advantage of the modular structure of Clang, especially since I don't need to do any compilation in my program. There might be an Action subclass for what I want to do that I could use with the Driver library, though.

Note that you can just write your own action... subclassing
ASTFrontendAction is designed to be straightforward.  For a simple
example, look at lib/Frontend/BoostConAction.cpp and the corresponding
class declaration in include/clang/Frontend/FrontendActions.h.

-Eli




More information about the cfe-dev mailing list