From: Anna Zaks Date: Sat, 8 Jun 2013 00:29:29 +0000 (+0000) Subject: [analyzer] Minor fixups to r183062 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3370859a809e5fa6c27659095c7349ce1c321233;p=clang [analyzer] Minor fixups to r183062 Based on feedback from Jordan. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183600 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 9f8a1da0ce..c5286d1a50 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -282,14 +282,14 @@ private: /// Check if the function is known free memory, or if it is /// "interesting" and should be modeled explicitly. /// - /// \param EscapingSymbol A function might not free memory in general, but - /// could be known to free a particular symbol. In this case, false is + /// \param [out] EscapingSymbol A function might not free memory in general, + /// but could be known to free a particular symbol. In this case, false is /// returned and the single escaping symbol is returned through the out /// parameter. /// /// We assume that pointers do not escape through calls to system functions /// not handled by this checker. - bool mayFreeAnyEscapedMemoryOrIsModelledExplicitely(const CallEvent *Call, + bool mayFreeAnyEscapedMemoryOrIsModeledExplicitly(const CallEvent *Call, ProgramStateRef State, SymbolRef &EscapingSymbol) const; @@ -1848,12 +1848,13 @@ ProgramStateRef MallocChecker::evalAssume(ProgramStateRef state, return state; } -bool MallocChecker::mayFreeAnyEscapedMemoryOrIsModelledExplicitely( +bool MallocChecker::mayFreeAnyEscapedMemoryOrIsModeledExplicitly( const CallEvent *Call, ProgramStateRef State, SymbolRef &EscapingSymbol) const { assert(Call); - + EscapingSymbol = 0; + // For now, assume that any C++ call can free memory. // TODO: If we want to be more optimistic here, we'll need to make sure that // regions escape to C++ containers. They seem to do that even now, but for @@ -2030,8 +2031,8 @@ ProgramStateRef MallocChecker::checkPointerEscapeAux(ProgramStateRef State, // call later, keep tracking the top level arguments. SymbolRef EscapingSymbol = 0; if (Kind == PSK_DirectEscapeOnCall && - !mayFreeAnyEscapedMemoryOrIsModelledExplicitely(Call, State, - EscapingSymbol) && + !mayFreeAnyEscapedMemoryOrIsModeledExplicitly(Call, State, + EscapingSymbol) && !EscapingSymbol) { return State; }