[cfe-dev] Cannot parse the Linux kernel

Eli Friedman eli.friedman at gmail.com
Thu Jun 11 02:23:16 PDT 2009


On Thu, Jun 11, 2009 at 1:49 AM, Roberto Bagnara<bagnara at cs.unipr.it> wrote:
>
> Hi there,
>
> there are heavily used versions of the Linux kernel that
> cannot be parsed by clang due to the following bugs:
>
> http://llvm.org/bugs/show_bug.cgi?id=4236
> http://llvm.org/bugs/show_bug.cgi?id=3429
>
> Are there plans to fix them?  Note that changing the
> kernel code is, unfortunately, not an option.

We definitely intend to implement __label__ support relatively soon;
it's just a matter of someone writing the patch.  (It's non-trivial,
but it shouldn't be particularly hard.)

As for PR4236, I'm not really sure about the best way to go about
fixing it, or whether we even want to,  It'd require some
platform-specific code to figure out how to translate situations like
that into LLVM inline asm in a gcc-compatible way, and we don't really
want to add weird hacks for rare edge cases.  If you don't care about
CodeGen, though, you can just comment out the relevant error-checking
code in SemaStmt.cpp; the resulting AST will still be well-formed.

On a side note, what are you trying to do that requiring a one-line
change somehow breaks it?  If you don't want to touch your kernel
sources, you could always write a wrapper around clang that patches
the file in question, then pipes it into clang.

-Eli




More information about the cfe-dev mailing list