[cfe-dev] libclang crash when parsing MS-style inline assembly
Kim Gräsman
kim.grasman at gmail.com
Wed Oct 30 05:19:00 PDT 2013
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
More information about the cfe-dev
mailing list