[cfe-dev] libclang crash when parsing MS-style inline assembly

Alp Toker alp at nuanti.com
Thu Nov 7 23:01:56 PST 2013


William, Kim,

Now that we've dealt with the underlying crash, we can start to look at
how to handle this cleanly.

I'd like to understand your requirements first..

For your use cases, would it be acceptable to skip over the MS inline
assembly without parsing it, ie. having a special mode that turns this
into a soft error in parse-only tools?

Alp.


On 30/10/2013 12:19, Kim Gräsman wrote:
> Hi William,
>
> On Wed, Oct 30, 2013 at 12:50 PM, William Ledoux
> <william.ledoux at gmail.com> wrote:
>> For what I understood, clang, in cc1_main, will initialize targets and
>> targets' functions with the following 4 lines, whereas libclang won't.
>>
>>   llvm::InitializeAllTargets();
>>   llvm::InitializeAllTargetMCs();
>>   llvm::InitializeAllAsmPrinters();
>>   llvm::InitializeAllAsmParsers();
>>
>> Just for testing purpose, adding those 4 lines somewhere in
>> clang_createIndex fixes the problem. I know this is probably wrong, but did
>> it just to see if more problems were hiding behind.
> We added a similar workaround in a clang-based tool, first thing in main():
>
>   llvm::InitializeNativeTarget();
>   llvm::InitializeNativeTargetAsmParser();
>
> This fixed a crash I saw when some Windows header with inline assembly
> was parsed.
>
> I can't vouch for its goodness, just wanted to add a data point.
>
> - Kim
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list