Add a warning for builtin_return_address/frame_address with > 0 argument
authorJeremy Stenglein <jstenglein@gmail.com>
Mon, 9 Mar 2020 17:17:15 +0000 (10:17 -0700)
committerErich Keane <erich.keane@intel.com>
Mon, 9 Mar 2020 17:43:09 +0000 (10:43 -0700)
commit843a9778fcd5ef93804fc22de04af9ab8c8b20a9
tree4b3f6ebab94fa92f835d992236b1bd2471decd6a
parenteb682b80274d5486d062e3f53040969f592277e4
Add a warning for builtin_return_address/frame_address with > 0 argument

Clang is missing a warning for
builtin_return_address/builtin_frame_address called with > 0 argument.
Gcc provides a warning for this via -Wframe-address:

https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html

As calling these functions with argument > 0 has caused several crashes
for us, we would like to have the same warning as gcc here. This diff
adds the warning and makes it part of -Wmost.

Differential Revision: https://reviews.llvm.org/D75768
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaChecking.cpp
clang/test/Misc/warning-wall.c