Clang error recovery
Don
nospam at nospam.com
Tue Apr 6 12:32:32 PDT 2010
Ary Borenszweig wrote:
> bearophile wrote:
>> This is the latest post on the LLVM blog, "Amazing feats of Clang
>> Error Recovery", by Chris Lattner:
>> http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html
>>
>> I've compared dmd to few of those examples of Clang usage. I don't
>> comment each one of those things because some of them are specific of
>> C++, and because I don't understand some other of them. If you can
>> write better translations to D or if you understand more of them, you
>> can add and show me more comparisons :-)
>>
>> =============================
>>
>> Clang:
>>
>>
>> int foo(int x, pid_t y) {
>> return x+y;
>> }
>>
>>
>> t.c:1:16: error: unknown type name 'pid_t'
>> int foo(int x, pid_t y) {
>> ^
>>
>> -----------------
>>
>> dmd 2.042:
>>
>> int foo(int x, pid_t y) {
>> return x+y;
>> }
>> void main() {}
>>
>>
>> temp.d(1): Error: identifier 'pid_t' is not defined
>> temp.d(1): Error: pid_t is used as a type
>> temp.d(1): Error: cannot have parameter of type void
>>
>> -----------------
>>
>> Here Clangs gives a single error message (and it gives the error column).
>> Here the errors given by dmd give the same information.
>> Here dmd gives error messages that are better than GCC 4.2 ones, but I
>> think a single good error message is better than three.
>
> dmd has an ErrorType when an expression or something gives an error. The
> problem is it is a kind of an alias of an int type, so it continues to
> give errors. If such ErrorType would not trigger errors anymore, that
> would solve the problem. (in some cases I think a void type is returned
> instead of an error type)
There's also an ErrorExpression which is used in many places, and it
generally works properly in supressing errors. (__error shows up in
error messages when it hasn't been treated properly).
More information about the Digitalmars-d
mailing list