]> granicus.if.org Git - clang/commit
Add a simple new warning to catch blatantly dangling pointer and
authorChandler Carruth <chandlerc@gmail.com>
Sat, 3 Sep 2011 01:14:15 +0000 (01:14 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 3 Sep 2011 01:14:15 +0000 (01:14 +0000)
commit81c6477bcd39b6b1a0a7d9c38da5ab8cbb6ea565
treefc6949d25cd902e365f39e897197c6ddca64c0eb
parent0f2c1ce4661a6d767441b74f0c71f8bf93db91d6
Add a simple new warning to catch blatantly dangling pointer and
reference members of classes. We've had several bugs reported because of
this, and there's no reason not to flag it right away in the compiler.

Comments especially welcome on the strategy for implementing this
warning (IE, what should trigger this?) and on the text of the warning
itself.

I'm going to extend this to cover obvious cases with temporaries and
beef up the test cases some in subsequent patches. I'll then run it over
a large codebase and make sure its not misbehaving before I add it to
-Wall or turn it on by default. I think this one might be a good
candidate for on by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139075 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDeclCXX.cpp