doctaweeks / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

Fix crash when running IWYU on IWYU #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Purpose of code changes on this branch:
When I tried to run IWYU on IWYU itself on Windows, it crashed.

After some digging, I learned that tools need to call 
llvm::InitializeNativeTarget and friends in order for target-specific 
operations to be wired up correctly. Presumably there's something in the 
Windows build triggering inline asm parsing.

After the review, I'll merge this branch into:
/trunk

Original issue reported on code.google.com by kim.gras...@gmail.com on 26 Jun 2013 at 8:04

Attachments:

GoogleCodeExporter commented 9 years ago
On Mac OS X IWYU works fine with and without this patch. Patch looks good to 
me. But I think we should keep an eye on this code. IWYU doesn't perform JITing 
and if JIT is required by Windows headers, I believe all JIT preparations will 
be done by Clang itself. So I expect that this code will be unnecessary in the 
future.

Original comment by vsap...@gmail.com on 30 Jun 2013 at 5:38

GoogleCodeExporter commented 9 years ago
Thanks for double-checking. Not sure what you mean by "JITing"? The code is 
invoked as part of parsing inline assembly in winnt.h, there should be no code 
generation going on.

Original comment by kim.gras...@gmail.com on 30 Jun 2013 at 7:35

GoogleCodeExporter commented 9 years ago
Fixed by r474.

Original comment by kim.gras...@gmail.com on 30 Jun 2013 at 7:38

GoogleCodeExporter commented 9 years ago
I've assumed that InitializeNativeTarget() is used for JIT from its usage. I've 
encountered it in HowToUseJIT.cpp, ParallelJIT.cpp, clang-interpreter/main.cpp, 
lli.cpp, llvm-jitlistener.cpp, JITEventListenerTest.cpp, 
JITEventListenerTestCommon.h, JITTest.cpp, MCJITTestAPICommon.h.

Original comment by vsap...@gmail.com on 30 Jun 2013 at 9:00

GoogleCodeExporter commented 9 years ago
Ah, I see. I also noticed that the comment I copied mentioned JIT, maybe I 
should update that to mention inline assembly parsing.

We could probably get away without initialising assembly generation as well. 
I'll look into it.

Original comment by kim.gras...@gmail.com on 1 Jul 2013 at 4:55