[cfe-dev] libclang crash when parsing MS-style inline assembly
Alp Toker
alp at nuanti.com
Fri Nov 8 11:54:47 PST 2013
On 08/11/2013 19:52, Reid Kleckner wrote:
> On Fri, Nov 8, 2013 at 1:12 AM, Kim Gräsman <kim.grasman at gmail.com
> <mailto:kim.grasman at gmail.com>> wrote:
>
> Hi Alp,
>
> On Fri, Nov 8, 2013 at 8:01 AM, Alp Toker <alp at nuanti.com
> <mailto:alp at nuanti.com>> wrote:
> >
> > 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?
>
> For me, I think so.
>
> We ran into this in IWYU [1], and I don't think inline assembly would
> introduce a "use" of any significance...
>
>
> Muahahaha:
>
> // foo.h
> struct Foo {
> static const int x = 20;
> };
> // foo.cc
> int main() {
> int r;
> __asm {
> mov ecx, Foo::x
> mov r, ecx
> };
> return r;
> }
>
> Seems like a use that is relevant to IWYU. :)
Exactly what I was thinking.
Looks like we'll end up having to do something like this for both
Tooling and libclang :-/
LLVMInitializeX86TargetInfo();
LLVMInitializeX86TargetMC();
LLVMInitializeX86AsmParser();
On the plus side, it only pulls in an extra 1M on the binary size.
Alp.
>
>
> I'm not sure what you mean by "soft error", but I think I'd just
> ignore it completely rather than spewing diagnostics for things we
> can't affect and don't really care about.
>
> We don't use libclang, the problem is a little different there, as
> they can't initialize the respective targets. Our current workaround
> solves the problem for us.
>
> Thanks!
>
> - Kim
>
> [1] https://code.google.com/p/include-what-you-use/
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu <mailto: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