[Clang] Add machinery to catch overflow in unary minus outside of a constant expressi...
authorShafik Yaghmour <shafik.yaghmour@intel.com>
Tue, 31 Jan 2023 17:33:06 +0000 (09:33 -0800)
committerShafik Yaghmour <shafik.yaghmour@intel.com>
Tue, 31 Jan 2023 17:35:12 +0000 (09:35 -0800)
commit67ee18cc7a308ae8418689c4f03a1be73b8b874a
tree1427f8ad1e36ea0ef638b6095b5571f008d17869
parentc53eff55e5b0a346b3fe8898411d63edfc786785
[Clang] Add machinery to catch overflow in unary minus outside of a constant expression context

We provide several diagnostics for various undefined behaviors due to signed
integer overflow outside of a constant expression context. We were missing the
machinery to catch overflows due to unary minus.

Fixes: https://github.com/llvm/llvm-project/issues/31643

Differential Revision: https://reviews.llvm.org/D142867
clang/docs/ReleaseNotes.rst
clang/lib/AST/ExprConstant.cpp
clang/lib/Sema/SemaChecking.cpp
clang/test/CXX/expr/expr.const/p2-0x.cpp
clang/test/SemaCXX/integer-overflow.cpp
clang/unittests/Support/TimeProfilerTest.cpp