aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-03 23:08:49 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-03 23:08:49 +0000
commit9da59a67a27a4d3fc9d59552f07808a32f85e9d3 (patch)
tree4be5d7b80e8b3e2a8e435b4e80b5a56682947c28 /include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
parent7ad4848d4744b8d60289f3e359250cebdaaf7114 (diff)
[analyzer] Track null/uninitialized C++ objects used in method calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h')
-rw-r--r--include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index 8e50833a3e..0843baa089 100644
--- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -420,8 +420,17 @@ protected:
CXXInstanceCall(const CXXInstanceCall &Other) : SimpleCall(Other) {}
public:
+ /// \brief Returns the expression representing the implicit 'this' object.
+ virtual const Expr *getCXXThisExpr() const = 0;
+
/// \brief Returns the value of the implicit 'this' object.
- virtual SVal getCXXThisVal() const = 0;
+ SVal getCXXThisVal() const {
+ const Expr *Base = getCXXThisExpr();
+ // FIXME: This doesn't handle an overloaded ->* operator.
+ if (!Base)
+ return UnknownVal();
+ return getSVal(Base);
+ }
virtual const Decl *getRuntimeDefinition() const;
@@ -453,7 +462,7 @@ public:
return cast<CXXMemberCallExpr>(SimpleCall::getOriginExpr());
}
- virtual SVal getCXXThisVal() const;
+ virtual const Expr *getCXXThisExpr() const;
virtual Kind getKind() const { return CE_CXXMember; }
@@ -492,7 +501,7 @@ public:
return getOriginExpr()->getArg(Index + 1);
}
- virtual SVal getCXXThisVal() const;
+ virtual const Expr *getCXXThisExpr() const;
virtual Kind getKind() const { return CE_CXXMemberOperator; }