llvm-project/clang/lib/StaticAnalyzer/Core
Artem Dergachev 7d4694547a [analyzer] Escape pointers stored into top-level parameters with destructors.
Writing stuff into an argument variable is usually equivalent to writing stuff
to a local variable: it will have no effect outside of the function.
There's an important exception from this rule: if the argument variable has
a non-trivial destructor, the destructor would be invoked on
the parent stack frame, exposing contents of the otherwise dead
argument variable to the caller.

If such argument is the last place where a pointer is stored before the function
exits and the function is the one we've started our analysis from (i.e., we have
no caller context for it), we currently diagnose a leak. This is incorrect
because the destructor of the argument still has access to the pointer.
The destructor may deallocate the pointer or even pass it further.

Treat writes into such argument regions as "escapes" instead, suppressing
spurious memory leak reports but not messing with dead symbol removal.

Differential Revision: https://reviews.llvm.org/D60112

llvm-svn: 358321
2019-04-13 02:01:45 +00:00
..
APSIntType.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AnalysisManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
AnalyzerOptions.cpp [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
BasicValueFactory.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BlockCounter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
BugReporter.cpp Range-style std::find{,_if} -> llvm::find{,_if}. NFC 2019-03-31 08:48:19 +00:00
BugReporterVisitors.cpp [analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers. 2019-04-05 20:18:53 +00:00
CMakeLists.txt [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
CallEvent.cpp Revert "[analyzer] Toning down invalidation a bit". 2019-04-03 18:21:16 +00:00
Checker.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CheckerContext.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CheckerHelpers.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CheckerManager.cpp [analyzer] Emit an error rather than assert on invalid checker option input 2019-03-08 16:00:42 +00:00
CommonBugCategories.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ConstraintManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CoreEngine.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DynamicTypeMap.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Environment.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ExplodedGraph.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ExprEngine.cpp [analyzer] Escape pointers stored into top-level parameters with destructors. 2019-04-13 02:01:45 +00:00
ExprEngineC.cpp [analyzer] PR37501: Disable assertion for logical op short circuit evaluation. 2019-03-29 22:43:34 +00:00
ExprEngineCXX.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ExprEngineCallAndReturn.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ExprEngineObjC.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
FunctionSummary.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
HTMLDiagnostics.cpp Use llvm::is_contained. NFC 2019-02-10 05:54:57 +00:00
IssueHash.cpp Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer* 2019-04-04 21:06:41 +00:00
LoopUnrolling.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopWidening.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MemRegion.cpp [analyzer] Add a comment that FunctionCodeRegions may also need canonicalization 2019-02-09 01:00:32 +00:00
PathDiagnostic.cpp [analyzer] Fix an assertation failure for invalid sourcelocation, add a new debug checker 2019-03-14 16:10:29 +00:00
PlistDiagnostics.cpp Remove unused variable to silence compiler warning [NFC] 2019-03-14 14:20:50 +00:00
PrettyStackTraceLocationContext.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ProgramState.cpp [analyzer] Move taint API from ProgramState to a separate header. NFC. 2019-03-29 22:49:30 +00:00
RangeConstraintManager.cpp [Analyzer] Constraint Manager - Calculate Effective Range for Differences 2019-03-28 13:05:59 +00:00
RangedConstraintManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegionStore.cpp [analyzer] Support C++17 aggregates with bases without constructors. 2019-03-15 00:22:59 +00:00
SMTConstraintManager.cpp Moved everything SMT-related to LLVM and updated the cmake scripts. 2019-03-25 17:47:45 +00:00
SValBuilder.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SVals.cpp Fix file headers. NFC 2019-03-01 06:49:51 +00:00
SarifDiagnostics.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SimpleConstraintManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SimpleSValBuilder.cpp [analyzer] Handle comparison between non-default AS symbol and constant 2019-03-07 13:01:17 +00:00
Store.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SubEngine.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SymbolManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
WorkList.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00