[cfe-commits] [PATCH] Bug 6484 - Improve diagnostics for dangling '}'

Jason Switzer jswitzer at gmail.com
Sun Jan 15 22:23:33 PST 2012


>
> On Sun, Jan 15, 2012 at 10:08 AM, Dmitri Gribenko <gribozavr at gmail.com>wrote:
>
>> A nice idea, but the implementation is not really correct.  Please
>> take a look at Parser::ParseExternalDeclaration in
>> llvm/tools/clan/lib/Parse/Parser.cpp:
>> err_expected_external_declaration is emitted in three cases, and only
>> one is the case of extra brace.  For example,
>> $ cat > a.c
>> +
>> $ clang a.c
>> a.c:1:1: error: expected external declaration
>> +
>> ^
>> 1 error generated.
>>
>> So I think you should add other (new) error message and change the
>> relevant case in Parser.cpp.
>
>
Taking your advice, I made a new error (err_extraneous_closing_brace) in
include/clang/Basic/DiagnosticParseKinds.td, switched the first case in
lib/Parse/Parser.cpp to using the new error, and updated the test cases
(again, all tests pass).

- Jason "s1n" Switzer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120116/0a4cb293/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug6484_v2.patch
Type: text/x-patch
Size: 2065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120116/0a4cb293/attachment.bin>


More information about the cfe-commits mailing list