[PATCH] D129573: [Clang] add a diagnostic note 'while loop outside functions' at global scope
Matheus Izvekov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 17 18:06:48 PDT 2022
mizvekov added inline comments.
================
Comment at: clang/test/Parser/while-loop-outside-function.c:3-4
+
+while(1) {}; // expected-error {{expected identifier or '('}} \
+ // expected-note {{while loop outside of functions}}
+
----------------
inclyc wrote:
> mizvekov wrote:
> > How about just making the error be the same thing the note would say?
> >
> >
> OK, so just create a new error directly, and then report the error when encountering the `while` token?
Well the end result should be that there is only one error, `while` outside of function, because that explains everything the user needs to know.
It would be strange to report the `expected identifier or ...` error in addition to this one, it would be just noise.
How to go about implementing that I leave it up to you :P
Unless you need some specific help of course.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129573/new/
https://reviews.llvm.org/D129573
More information about the cfe-commits
mailing list