Fix two false positives in -Wreturn-stack-address
authorRichard Trieu <rtrieu@google.com>
Fri, 5 Aug 2016 23:24:47 +0000 (23:24 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 5 Aug 2016 23:24:47 +0000 (23:24 +0000)
commit81b6c561eaeb2a48318523a037e6903d34f5fec3
tree2573ed1a4e12c1561d4a9135555a2065ccbceddf
parent9e91c28b7121f726b3ee62bd5d17abb9bfe6841a
Fix two false positives in -Wreturn-stack-address

If the return type is a pointer and the function returns the reference to a
pointer, don't warn since only the value is returned, not the reference.

If a reference function parameter appears in the reference chain, don't warn
since binding happens at the caller scope, so addresses returned are not
to local stack.  This includes default arguments as well.

llvm-svn: 277889
clang/lib/Sema/SemaChecking.cpp
clang/test/SemaCXX/return-stack-addr-2.cpp