aboutsummaryrefslogtreecommitdiff
path: root/clang/include
diff options
context:
space:
mode:
authorinclyc <me@inclyc.cn>2022-07-13 00:12:12 +0800
committerinclyc <me@inclyc.cn>2022-07-25 11:48:24 +0800
commitedaae251cca07c34c55905c424a8f677623d0bd0 (patch)
tree8706fecbbf9d779c185b876d0d9d0863b173087d /clang/include
parent1ef32e78284bc758112632e9e190b6683ea5b95b (diff)
downloadllvm-edaae251cca07c34c55905c424a8f677623d0bd0.zip
llvm-edaae251cca07c34c55905c424a8f677623d0bd0.tar.gz
llvm-edaae251cca07c34c55905c424a8f677623d0bd0.tar.bz2
[clang] better error message for while loops outside of control flow
report an error when encountering 'while' token parsing declarator ``` clang/test/Parser/while-loop-outside-function.c:3:1: error: while loop outside of a function while // expected-error {{while loop outside of a function}} ^ clang/test/Parser/while-loop-outside-function.c:7:1: error: while loop outside of a function while // expected-error {{while loop outside of a function}} ^ ``` Fixes: https://github.com/llvm/llvm-project/issues/34462 Differential Revision: https://reviews.llvm.org/D129573
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Basic/DiagnosticParseKinds.td2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 352a050b..bad6c09 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -538,6 +538,8 @@ def err_invalid_operator_on_type : Error<
"cannot use %select{dot|arrow}0 operator on a type">;
def err_expected_unqualified_id : Error<
"expected %select{identifier|unqualified-id}0">;
+def err_while_loop_outside_of_a_function : Error<
+ "while loop outside of a function">;
def err_brackets_go_after_unqualified_id : Error<
"brackets are not allowed here; to declare an array, "
"place the brackets after the %select{identifier|name}0">;