Revert "[analyzer] Model casts to bool differently from other numbers."
This seems to be causing quite a slowdown on our internal analyzer bot,
and I'm not sure why. Needs further investigation.
This reverts r180638 / 9e161ea981f22ae017b6af09d660bfc3ddf16a09.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180714 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/stack-addr-ps.cpp b/test/Analysis/stack-addr-ps.cpp
index 65d7571..7aefea5 100644
--- a/test/Analysis/stack-addr-ps.cpp
+++ b/test/Analysis/stack-addr-ps.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-store=region -verify %s
-typedef __INTPTR_TYPE__ intptr_t;
-
+// FIXME: Only the stack-address checking in Sema catches this right now, and
+// the stack analyzer doesn't handle the ImplicitCastExpr (lvalue).
const int& g() {
int s;
return s; // expected-warning{{Address of stack memory associated with local variable 's' returned}} expected-warning{{reference to stack memory associated with local variable 's' returned}}
@@ -96,40 +96,3 @@
return p; // expected-warning {{stack memory associated with local variable 'p' returned to caller}}
}
-namespace rdar13296133 {
- class ConvertsToBool {
- public:
- operator bool() const { return this; }
- };
-
- class ConvertsToIntptr {
- public:
- operator intptr_t() const { return reinterpret_cast<intptr_t>(this); }
- };
-
- class ConvertsToPointer {
- public:
- operator const void *() const { return this; }
- };
-
- intptr_t returnAsNonLoc() {
- ConvertsToIntptr obj;
- return obj; // expected-warning{{Address of stack memory associated with local variable 'obj' returned to caller}}
- }
-
- bool returnAsBool() {
- ConvertsToBool obj;
- return obj; // no-warning
- }
-
- intptr_t returnAsNonLocViaPointer() {
- ConvertsToPointer obj;
- return reinterpret_cast<intptr_t>(static_cast<const void *>(obj)); // expected-warning{{Address of stack memory associated with local variable 'obj' returned to caller}}
- }
-
- bool returnAsBoolViaPointer() {
- ConvertsToPointer obj;
- return obj; // no-warning
- }
-}
-