[all-commits] [llvm/llvm-project] edaae2: [clang] better error message for while loops outsi...

inclyc via All-commits all-commits at lists.llvm.org
Sun Jul 24 20:49:17 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: edaae251cca07c34c55905c424a8f677623d0bd0
      https://github.com/llvm/llvm-project/commit/edaae251cca07c34c55905c424a8f677623d0bd0
  Author: inclyc <me at inclyc.cn>
  Date:   2022-07-25 (Mon, 25 Jul 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/lib/Parse/ParseDecl.cpp
    A clang/test/Parser/while-loop-outside-function.c
    A clang/test/Parser/while-loop-outside-function.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list