Commit Graph

12 Commits

Author SHA1 Message Date
Richard Smith 2177e4555a PR47861: Expand dangling reference warning to look through copy
construction, and to assume that assignment operators return *this.
2020-10-30 10:19:50 -07:00
Richard Smith a3fd116219 Don't lifetime-extend or track lifetime problems through the LHS of '->*'.
Fixes a false-positive warning found by selfhost.

llvm-svn: 337857
2018-07-24 21:18:30 +00:00
Richard Smith afe48f9d68 Fold -Wreturn-stack-address into general initialization lifetime
checking.

llvm-svn: 337743
2018-07-23 21:21:22 +00:00
Richard Smith 40f08ebece Don't produce a 'returning reference to local' warning if a lambda returns a
reference (or pointer) to a variable from the closure object or from the
surrounding function scope.

llvm-svn: 200494
2014-01-30 22:05:38 +00:00
Chandler Carruth 78494f50e5 Remove a type that got reduced away from this test case but not actually deleted.
llvm-svn: 121694
2010-12-13 08:01:53 +00:00
Chandler Carruth 7a6d2e9ca1 Fix PR8774 by restricting when hasInit returns true. Previously, it
would return true if the initializer pointer union had *any* non-null
pointer in it, even if the pointer wasn't one that would actually be
returned via getInit(). This makes it more accurately model the logic of
'getInit() != NULL'.

This still isn't completely satisfying. From a principled stance,
I suspect we should make hasInit() and getInit() *always* return false
and NULL (resp.) for ParmVarDecl. We shouldn't at the API level treat
initializers and default arguments as the same thing.

llvm-svn: 121692
2010-12-13 07:40:47 +00:00
Ted Kremenek cbe6b0b846 Enhance return-stack-address check (in Sema) to handle fields that themselves are references. (Fixes PR 7999; fix by Chandler Carruth).
llvm-svn: 112792
2010-09-02 01:12:13 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Douglas Gregor e200adc503 Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
  - ImplicitCastExpr is (still) used for all explicit casts
  - ExplicitCastExpr is now the root of all *explicit* casts
  - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
  - CXXFunctionalCastExpr inherits from ExplicitCastExpr
  - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
    of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
  - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, 
    CXXReinterpretCastExpr, and CXXConstCastExpr to 

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.

llvm-svn: 58264
2008-10-27 19:41:14 +00:00
Sebastian Redl 344fc3db3f Fix some invalid casts that are detected by Sema now or soon.
llvm-svn: 58252
2008-10-27 16:34:21 +00:00
Argyrios Kyrtzidis 3d0f51d703 Move the rest of the Sema C++ tests into the SemaCXX test directory.
llvm-svn: 55178
2008-08-22 15:43:49 +00:00