diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-30 23:39:47 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-30 23:39:47 +0000 |
commit | 57c033621dacd8720ac9ff65a09025f14f70e22f (patch) | |
tree | f5ddbd4787a29c32786be7b60c4b5130759734d5 /include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h | |
parent | d64effc4e31044c05d6e4400150edb26e914983a (diff) |
[analyzer] Perform post-call checks for all inlined calls.
Previously, we were only checking the origin expressions of inlined calls.
Checkers using the generic postCall and older postObjCMessage callbacks were
ignored. Now that we have CallEventManager, it is much easier to create
a CallEvent generically when exiting an inlined function, which we can then
use for post-call checks.
No test case because we don't (yet) have any checkers that depend on this
behavior (which is why it hadn't been fixed before now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161005 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h')
-rw-r--r-- | include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h index 74ac253d99..bc9320f283 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h @@ -59,6 +59,13 @@ public: CallEventRef<T> cloneWithState(ProgramStateRef State) const { return this->getPtr()->template cloneWithState<T>(State); } + + // Allow implicit conversions to a superclass type, since CallEventRef + // behaves like a pointer-to-const. + template <typename SuperT> + operator CallEventRef<SuperT> () const { + return this->getPtr(); + } }; /// \brief Represents an abstract call to a function or method along a @@ -807,6 +814,11 @@ class CallEventManager { public: CallEventManager(llvm::BumpPtrAllocator &alloc) : Alloc(alloc) {} + + CallEventRef<> + getCaller(const StackFrameContext *CalleeCtx, ProgramStateRef State); + + CallEventRef<SimpleCall> getSimpleCall(const CallExpr *E, ProgramStateRef State, const LocationContext *LCtx); @@ -871,4 +883,16 @@ inline void CallEvent::Release() const { } // end namespace ento } // end namespace clang +namespace llvm { + // Support isa<>, cast<>, and dyn_cast<> for CallEventRef. + template<class T> struct simplify_type< clang::ento::CallEventRef<T> > { + typedef const T *SimpleType; + + static SimpleType + getSimplifiedValue(const clang::ento::CallEventRef<T>& Val) { + return Val.getPtr(); + } + }; +} + #endif |