[PATCH] D129573: [clang] add a diagnostic note 'while loop outside functions' at global scope
YingChi Long via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 21 19:36:36 PDT 2022
inclyc marked 2 inline comments as not done.
inclyc added inline comments.
================
Comment at: clang/test/Parser/while-loop-outside-function.c:3
+
+while // expected-error {{while loop outside of a function}}
+(1) {};
----------------
Thanks a lot for your suggestion, I replaced this statement with two lines to test if the diagnostics are correctly given at the token `while`.
The C++ test cases is also changed like this.
================
Comment at: clang/test/Parser/while-loop-outside-function.c:10
+
+int overload_return(); // expected-note {{previous declaration is here}}
+
----------------
This test case checks whether the program can correctly diagnose other errors after reporting our newly added error
================
Comment at: clang/test/Parser/while-loop-outside-function.c:24
+void correct() {
+ while(1) {};
+ while(1);
----------------
Should not give diagnostic information at these 2 lines of correct statements
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129573/new/
https://reviews.llvm.org/D129573
More information about the cfe-commits
mailing list