[cfe-dev] Clang parser diagnostics

Jean-Daniel Dupas devlists at shadowlab.org
Sun Aug 23 02:37:47 PDT 2009


Le 22 août 2009 à 06:53, Ken Camann a écrit :

> Hello everyone.
>
> First, let me say I'm very impressed with both the clang and LLVM
> projects.  The quality of the clang source code is so good that I've
> learned a lot about how compilers work just from reading it.
>
> In fact, I am writing a compiler for a different language using clang
> as a sort of "design guide".  So far I've gotten to the parser, and
> I've noticed something interesting about the way clang generates parse
> error diagnostics.
>
> If you type something like:
>
> "x = 3 * * 4"
>
> it will point to the second "*" and say "expected expression", because
> a node for the operator precedence parser was expected.  However, this
> is not really in keeping with the design philosophy of very expressive
> error messages.


How do you get this message ? :

--------
int test() {
	int x = 3 * * 4;
	return x;
}
-----------

test.c:3:12: error: indirection requires pointer operand ('int' invalid)
         int x = 3**4;






More information about the cfe-dev mailing list