[cfe-dev] Using clang as a meta-data generator.

chris nuernberger cnuernber at gmail.com
Tue Jun 22 10:46:06 PDT 2010


Thanks a lot Doug!

I have enough compiling to take the next step.  I just wanted to
finish up with where I am in case there is another quick set of fixes
that will help.

The exact error text is:

clang: error: unable to execute command: Couldn't execute program 'clang'
clang: error: clang frontend command failed due to signal 1 (use -v to
see invocation)

I will certainly file a bug, going through the login process of bugzilla now.

I am down to just three errors.  I needed -ms-extensions and
-nobuildininc because clang has its own float.h header which was
conflict with the platform float.h.

Doing that, I am down to just three errors:

if(!ignore) __debugbreak();

Debug break intrinsic doesn't appear to exist, even with
-ms-extensions.  It should be __asm { int 3 }.

next:

In file included from C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/new:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/exception:40:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include/eh.h(61)
:  error: unknown type name 'type_info'
_CRTIMP int __cdecl _is_exception_typeof(_In_ const type_info &_Type,
_In_ struct _EXCEPTION_POINTERS * _ExceptionPtr);


Don't know what to make of that yet.


In file included from C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/new:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/exception:41:
C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/malloc.h(252) :  error: expected expression
            _ASSERTE(("Corrupted pointer passed to _freea", 0));

Continuing with the macro expansion:

C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/crtdbg.h:485:25: note: instantiated from:
#define _ASSERTE(expr)  _ASSERT_EXPR((expr), _CRT_WIDE(#expr))
                        ^
C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/crtdbg.h:478:18: note: instantiated from:
                (_CrtDbgBreak(), 0))
                 ^
C:\Program Files (x86)\Microsoft Visual Studio
9.0\VC\include/crtdbg.h:593:24: note: instantiated from:
#define _CrtDbgBreak() __asm { int 3 }
                                   ^

The caret is under the first underscore of the asm block.

I have got enough to compile that I am totally confident to take the
next steps, btw, so thanks for you help Doug!

Chris

On Tue, Jun 22, 2010 at 10:56 AM, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Jun 22, 2010, at 9:16 AM, chris nuernberger wrote:
>
>> OK, cool.  I have it producing an AST.  I don't need it to compile or
>> even produce a perfect AST, but I do need it to attempt to produce as
>> much of the AST as it can.  It appears to do that; can I always count
>> on that behavior?
>
> Yes.
>
>> This is on a large, established code base (PhysX) so I can't mess with
>> the code base much nor do I want to.
>>
>> So, just some notes: unless I use cc1, I get a bizarre error message
>> stating that clang itself can't execute "clang".  It appears the
>> driver wraps the clang invocation with many more command line
>> arguments and relaunches.  This doesn't appear to work on windows; at
>> least not right now.
>
> I've not seen this issue before. Please file a bug with more information when you get the chance.
>
>> __int64 isn't an intrinsic type so the windows c headers won't
>> compile.  Judging by the compiler output, it looks like you would want
>> a truly portable std library implementation or something like that.
>
> Pass -fms-extensions to turn on Microsoft compatibility mode, which includes a definition of __int64.
>
>> For this stage of the project, I just need to know variable names.
>>
>> For the next stage, when I need to mangle binary data, I will need to
>> know the exact binary offsets of member variables.  How do you
>> recommend I go about getting this information?  It seems much later in
>> the pipeline but something must annotate the AST graph with such
>> information somewhere...
>
>
> ASTContext::getASTRecordLayout will give you this information for any complete RecordDecl.
>
>        - Doug



-- 
A foolish consistency is the hobgoblin of little minds - Emerson




More information about the cfe-dev mailing list