Make 'static assertion failed' diagnostics point to the static assertion expression
authorJorge Pinto Sousa <jorge.pinto.sousa@proton.me>
Thu, 13 Apr 2023 12:14:14 +0000 (08:14 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 13 Apr 2023 12:15:13 +0000 (08:15 -0400)
commit66202d83b5d47479ae0f8117aebb523ba7eff82d
tree0f325efe812cc99006b1e142be465731e996d657
parentdfafb7fe5af3e55ff35fb5dbc685a4337af5b29c
Make 'static assertion failed' diagnostics point to the static assertion expression

"static assertion failed" pointed to the static_assert token and
then underlined the static assertion expression:

<source>:3:1: error: static assertion failed
    static_assert(false);
    ^             ~~~~~
    1 error generated.
See Godbolt: https://godbolt.org/z/r38booz59

Now it points to and highlights the assertion expression.

Fixes https://github.com/llvm/llvm-project/issues/61951
Differential Revision: https://reviews.llvm.org/D147745
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/SemaCXX/static-assert.cpp