Commit Graph

11 Commits

Author SHA1 Message Date
Richard Smith 8b8872507a Don't lifetime-extend or track lifetime problems through the LHS of '->*'.
Fixes a false-positive warning found by selfhost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337857 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-24 21:18:30 +00:00
Richard Smith 354438d88c Fold -Wreturn-stack-address into general initialization lifetime
checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337743 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-23 21:21:22 +00:00
Richard Smith e3732a5c42 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200494 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-30 22:05:38 +00:00
Chandler Carruth 1192fff983 Remove a type that got reduced away from this test case but not actually deleted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121694 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 08:01:53 +00:00
Chandler Carruth e7f85047d0 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121692 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 07:40:47 +00:00
Ted Kremenek a423e81a4d Enhance return-stack-address check (in Sema) to handle fields that themselves are references. (Fixes PR 7999; fix by Chandler Carruth).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112792 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 01:12:13 +00:00
Daniel Dunbar a5728872c7 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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-15 20:14:24 +00:00
Daniel Dunbar d7d5f0223b Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Douglas Gregor 49badde06e 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 19:41:14 +00:00
Sebastian Redl 8b3f6b5c52 Fix some invalid casts that are detected by Sema now or soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 16:34:21 +00:00
Argyrios Kyrtzidis 4bd8217d94 Move the rest of the Sema C++ tests into the SemaCXX test directory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 15:43:49 +00:00