summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-12-20 00:38:25 +0000
committerAnna Zaks <ganna@apple.com>2012-12-20 00:38:25 +0000
commitdc15415da4cefd8494b8805906d0004abc66ae0a (patch)
tree2997984bdeab61595c06c62b904a1ec2fff889c7 /clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
parent8ac915055651e72b21f974760e4f2b55887591c8 (diff)
downloadbcm5719-llvm-dc15415da4cefd8494b8805906d0004abc66ae0a.tar.gz
bcm5719-llvm-dc15415da4cefd8494b8805906d0004abc66ae0a.zip
[analyzer] Add the pointer escaped callback.
Instead of using several callbacks to identify the pointer escape event, checkers now can register for the checkPointerEscape. Converted the Malloc checker to use the new callback. SimpleStreamChecker will be converted next. llvm-svn: 170625
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
index aec551fdb60..fa2c4ffb115 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
@@ -51,6 +51,7 @@ class CheckerDocumentation : public Checker< check::PreStmt<ReturnStmt>,
eval::Assume,
check::LiveSymbols,
check::RegionChanges,
+ check::PointerEscape,
check::Event<ImplicitNullDerefEvent>,
check::ASTDecl<FunctionDecl> > {
public:
@@ -246,13 +247,31 @@ public:
/// check::RegionChanges
ProgramStateRef
checkRegionChanges(ProgramStateRef State,
- const StoreManager::InvalidatedSymbols *Invalidated,
+ const InvalidatedSymbols *Invalidated,
ArrayRef<const MemRegion *> ExplicitRegions,
ArrayRef<const MemRegion *> Regions,
const CallEvent *Call) const {
return State;
}
+ /// \brief Called when pointers escape.
+ ///
+ /// This notifies the checkers about pointer escape, which occurs whenever
+ /// the analzyer cannot track the symbol any more. For example, as a
+ /// result of assigning a pointer into a global or when it's passed to a
+ /// function call the analyzer cannot model.
+ ///
+ /// \param State The state at the point of escape.
+ /// \param Escaped The list of escaped symbols.
+ /// \param Call The corresponding CallEvent, if the symbols escape as
+ /// parameters to the given call.
+ /// \returns Checkers can modify the state by returning a new state.
+ ProgramStateRef checkPointerEscape(ProgramStateRef State,
+ const InvalidatedSymbols &Escaped,
+ const CallEvent *Call) const {
+ return State;
+ }
+
/// check::Event<ImplicitNullDerefEvent>
void checkEvent(ImplicitNullDerefEvent Event) const {}
OpenPOWER on IntegriCloud