Add -Wreturn-local-addr, GCC alias for -Wreturn-stack-address

For warning compatibility with GCC.

Reviewed By: cjdb

Differential Revision: https://reviews.llvm.org/D139570
This commit is contained in:
Adrian Dole 2023-01-12 17:45:03 +00:00 committed by Christopher Di Bella
parent 824874c8d4
commit 8effeb44f4
3 changed files with 4 additions and 0 deletions

View File

@ -449,6 +449,7 @@ Improvements to Clang's diagnostics
concepts-ts compatibility extension.
- Clang now diagnoses overflow undefined behavior in a constant expression while
evaluating a compound assignment with remainder as operand.
- Add ``-Wreturn-local-addr``, a GCC alias for ``-Wreturn-stack-address``.
Non-comprehensive list of changes in this release
-------------------------------------------------

View File

@ -413,6 +413,8 @@ def DanglingField : DiagGroup<"dangling-field">;
def DanglingInitializerList : DiagGroup<"dangling-initializer-list">;
def DanglingGsl : DiagGroup<"dangling-gsl">;
def ReturnStackAddress : DiagGroup<"return-stack-address">;
// Name of this warning in GCC
def : DiagGroup<"return-local-addr", [ReturnStackAddress]>;
def Dangling : DiagGroup<"dangling", [DanglingField,
DanglingInitializerList,
DanglingGsl,

View File

@ -1,4 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -std=c++11 %s
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -std=c++11 -Wno-return-stack-address -Wreturn-local-addr %s
namespace PR26599 {
template <typename>