From b5b0fc196e8768076c3c9155cd79b248623861de Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Thu, 15 Nov 2012 19:11:27 +0000 Subject: [PATCH] [analyzer] Mark symbol values as dead in the environment. This allows us to properly remove dead bindings at the end of the top-level stack frame, using the ReturnStmt, if there is one, to keep the return value live. This in turn removes the need for a check::EndPath callback in leak checkers. This does cause some changes in the path notes for leak checkers. Previously, a leak would be reported at the location of the closing brace in a function. Now, it gets reported at the last statement. This matches the way leaks are currently reported for inlined functions, but is less than ideal for both. llvm-svn: 168066 --- .../StaticAnalyzer/Core/PathSensitive/ExprEngine.h | 43 ++-- clang/lib/StaticAnalyzer/Core/Environment.cpp | 4 + clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 28 ++- .../Core/ExprEngineCallAndReturn.cpp | 25 +- clang/test/Analysis/malloc-plist.c | 274 ++++++++++----------- clang/test/Analysis/malloc.c | 5 + clang/test/Analysis/plist-output-alternate.m | 67 ++++- 7 files changed, 262 insertions(+), 184 deletions(-) diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h index 78b2542..17de90e 100644 --- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h +++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h @@ -154,26 +154,33 @@ public: const ExplodedGraph& getGraph() const { return G; } /// \brief Run the analyzer's garbage collection - remove dead symbols and - /// bindings. + /// bindings from the state. /// - /// \param Node - The predecessor node, from which the processing should - /// start. - /// \param Out - The returned set of output nodes. - /// \param ReferenceStmt - Run garbage collection using the symbols, - /// which are live before the given statement. - /// \param LC - The location context of the ReferenceStmt. - /// \param DiagnosticStmt - the statement used to associate the diagnostic - /// message, if any warnings should occur while removing the dead (leaks - /// are usually reported here). - /// \param K - In some cases it is possible to use PreStmt kind. (Do - /// not use it unless you know what you are doing.) - /// If the ReferenceStmt is NULL, everything is this and parent contexts is - /// considered live. - /// If the stack frame context is NULL, everything on stack is considered - /// dead. + /// Checkers can participate in this process with two callbacks: + /// \c checkLiveSymbols and \c checkDeadSymbols. See the CheckerDocumentation + /// class for more information. + /// + /// \param Node The predecessor node, from which the processing should start. + /// \param Out The returned set of output nodes. + /// \param ReferenceStmt The statement which is about to be processed. + /// Everything needed for this statement should be considered live. + /// A null statement means that everything in child LocationContexts + /// is dead. + /// \param LC The location context of the \p ReferenceStmt. A null location + /// context means that we have reached the end of analysis and that + /// all statements and local variables should be considered dead. + /// \param DiagnosticStmt Used as a location for any warnings that should + /// occur while removing the dead (e.g. leaks). By default, the + /// \p ReferenceStmt is used. + /// \param K Denotes whether this is a pre- or post-statement purge. This + /// must only be ProgramPoint::PostStmtPurgeDeadSymbolsKind if an + /// entire location context is being cleared, in which case the + /// \p ReferenceStmt must either be a ReturnStmt or \c NULL. Otherwise, + /// it must be ProgramPoint::PreStmtPurgeDeadSymbolsKind (the default) + /// and \p ReferenceStmt must be valid (non-null). void removeDead(ExplodedNode *Node, ExplodedNodeSet &Out, - const Stmt *ReferenceStmt, const StackFrameContext *LC, - const Stmt *DiagnosticStmt, + const Stmt *ReferenceStmt, const LocationContext *LC, + const Stmt *DiagnosticStmt = 0, ProgramPoint::Kind K = ProgramPoint::PreStmtPurgeDeadSymbolsKind); /// processCFGElement - Called by CoreEngine. Used to generate new successor diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp index bab89c5..7dcd12c 100644 --- a/clang/lib/StaticAnalyzer/Core/Environment.cpp +++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp @@ -241,6 +241,10 @@ EnvironmentManager::removeDeadBindings(Environment Env, // Mark all symbols in the block expr's value live. RSScaner.scan(X); continue; + } else { + SymExpr::symbol_iterator SI = X.symbol_begin(), SE = X.symbol_end(); + for (; SI != SE; ++SI) + SymReaper.maybeDead(*SI); } } diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 045591c..42bfe14 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -268,22 +268,39 @@ static bool shouldRemoveDeadBindings(AnalysisManager &AMgr, void ExprEngine::removeDead(ExplodedNode *Pred, ExplodedNodeSet &Out, const Stmt *ReferenceStmt, - const StackFrameContext *LC, + const LocationContext *LC, const Stmt *DiagnosticStmt, ProgramPoint::Kind K) { assert((K == ProgramPoint::PreStmtPurgeDeadSymbolsKind || - ReferenceStmt == 0) + ReferenceStmt == 0 || isa(ReferenceStmt)) && "PostStmt is not generally supported by the SymbolReaper yet"); + assert(LC && "Must pass the current (or expiring) LocationContext"); + + if (!DiagnosticStmt) { + DiagnosticStmt = ReferenceStmt; + assert(DiagnosticStmt && "Required for clearing a LocationContext"); + } + NumRemoveDeadBindings++; CleanedState = Pred->getState(); - SymbolReaper SymReaper(LC, ReferenceStmt, SymMgr, getStoreManager()); + + // LC is the location context being destroyed, but SymbolReaper wants a + // location context that is still live. (If this is the top-level stack + // frame, this will be null.) + if (!ReferenceStmt) { + assert(K == ProgramPoint::PostStmtPurgeDeadSymbolsKind && + "Use PostStmtPurgeDeadSymbolsKind for clearing a LocationContext"); + LC = LC->getParent(); + } + + const StackFrameContext *SFC = LC ? LC->getCurrentStackFrame() : 0; + SymbolReaper SymReaper(SFC, ReferenceStmt, SymMgr, getStoreManager()); getCheckerManager().runCheckersForLiveSymbols(CleanedState, SymReaper); // Create a state in which dead bindings are removed from the environment // and the store. TODO: The function should just return new env and store, // not a new state. - const StackFrameContext *SFC = LC->getCurrentStackFrame(); CleanedState = StateMgr.removeDeadBindings(CleanedState, SFC, SymReaper); // Process any special transfer function for dead symbols. @@ -345,8 +362,7 @@ void ExprEngine::ProcessStmt(const CFGStmt S, EntryNode = Pred; ExplodedNodeSet CleanedStates; if (shouldRemoveDeadBindings(AMgr, S, Pred, EntryNode->getLocationContext())){ - removeDead(EntryNode, CleanedStates, currStmt, - Pred->getStackFrame(), currStmt); + removeDead(EntryNode, CleanedStates, currStmt, Pred->getLocationContext()); } else CleanedStates.Add(EntryNode); diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index 3ead081..a98e8b4 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -168,27 +168,24 @@ static SVal adjustReturnValue(SVal V, QualType ExpectedTy, QualType ActualTy, void ExprEngine::removeDeadOnEndOfFunction(NodeBuilderContext& BC, ExplodedNode *Pred, ExplodedNodeSet &Dst) { - NodeBuilder Bldr(Pred, Dst, BC); - // Find the last statement in the function and the corresponding basic block. const Stmt *LastSt = 0; const CFGBlock *Blk = 0; llvm::tie(LastSt, Blk) = getLastStmt(Pred); if (!Blk || !LastSt) { + Dst.Add(Pred); return; } - - // If the last statement is return, everything it references should stay live. - if (isa(LastSt)) - return; // Here, we call the Symbol Reaper with 0 stack context telling it to clean up // everything on the stack. We use LastStmt as a diagnostic statement, with - // which the PreStmtPurgeDead point will be associated. - currBldrCtx = &BC; - removeDead(Pred, Dst, 0, 0, LastSt, + // which the program point will be associated. However, we only want to use + // LastStmt as a reference for what to clean up if it's a ReturnStmt; + // otherwise, everything is dead. + SaveAndRestore NodeContextRAII(currBldrCtx, &BC); + removeDead(Pred, Dst, dyn_cast(LastSt), + Pred->getLocationContext(), LastSt, ProgramPoint::PostStmtPurgeDeadSymbolsKind); - currBldrCtx = 0; } static bool wasDifferentDeclUsedForInlining(CallEventRef<> Call, @@ -290,11 +287,11 @@ void ExprEngine::processCallExit(ExplodedNode *CEBNode) { NodeBuilderContext Ctx(getCoreEngine(), Blk, BindedRetNode); currBldrCtx = &Ctx; - // Here, we call the Symbol Reaper with 0 statement and caller location + // Here, we call the Symbol Reaper with 0 statement and callee location // context, telling it to clean up everything in the callee's context - // (and it's children). We use LastStmt as a diagnostic statement, which - // which the PreStmtPurge Dead point will be associated. - removeDead(BindedRetNode, CleanedNodes, 0, callerCtx, LastSt, + // (and its children). We use LastSt as a diagnostic statement, which + // which the program point will be associated. + removeDead(BindedRetNode, CleanedNodes, 0, calleeCtx, LastSt, ProgramPoint::PostStmtPurgeDeadSymbolsKind); currBldrCtx = 0; } else { diff --git a/clang/test/Analysis/malloc-plist.c b/clang/test/Analysis/malloc-plist.c index 12430a6..a99e34f 100644 --- a/clang/test/Analysis/malloc-plist.c +++ b/clang/test/Analysis/malloc-plist.c @@ -235,7 +235,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Assuming 'in' is > 5 // CHECK-NEXT: message -// CHECK-NEXT: Assuming 'in' is > 5 +// CHECK-NEXT: Assuming 'in' is > 5 // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -332,7 +332,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -380,7 +380,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'p' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'p' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'p' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'p' @@ -494,7 +494,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -517,13 +517,13 @@ void use_function_with_leak7() { // CHECK-NEXT: end // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line22 -// CHECK-NEXT: col1 +// CHECK-NEXT: line21 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line22 -// CHECK-NEXT: col1 +// CHECK-NEXT: line21 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -534,15 +534,15 @@ void use_function_with_leak7() { // CHECK-NEXT: kindevent // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line22 -// CHECK-NEXT: col1 +// CHECK-NEXT: line21 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: depth0 // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'A' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'A' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'A' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'A' @@ -550,11 +550,11 @@ void use_function_with_leak7() { // CHECK-NEXT: typeMemory leak // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contextmyArrayAllocation -// CHECK-NEXT: issue_hash4 +// CHECK-NEXT: issue_hash3 // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line22 -// CHECK-NEXT: col1 +// CHECK-NEXT: line21 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -622,7 +622,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -719,7 +719,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Attempt to reallocate memory // CHECK-NEXT: message -// CHECK-NEXT: Attempt to reallocate memory +// CHECK-NEXT: Attempt to reallocate memory // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -816,7 +816,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Assuming 'tmp' is null // CHECK-NEXT: message -// CHECK-NEXT: Assuming 'tmp' is null +// CHECK-NEXT: Assuming 'tmp' is null // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -879,7 +879,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Reallocation failed // CHECK-NEXT: message -// CHECK-NEXT: Reallocation failed +// CHECK-NEXT: Reallocation failed // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -927,7 +927,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'buf' @@ -1007,7 +1007,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'wrapper' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'wrapper' +// CHECK-NEXT: Calling 'wrapper' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -1021,7 +1021,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'test_wrapper' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'test_wrapper' +// CHECK-NEXT: Entered call from 'test_wrapper' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1118,7 +1118,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1215,7 +1215,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Assuming 'x' is non-null // CHECK-NEXT: message -// CHECK-NEXT: Assuming 'x' is non-null +// CHECK-NEXT: Assuming 'x' is non-null // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1278,7 +1278,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Returned allocated memory // CHECK-NEXT: message -// CHECK-NEXT: Returned allocated memory +// CHECK-NEXT: Returned allocated memory // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1301,13 +1301,13 @@ void use_function_with_leak7() { // CHECK-NEXT: end // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line46 -// CHECK-NEXT: col1 +// CHECK-NEXT: line45 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line46 -// CHECK-NEXT: col1 +// CHECK-NEXT: line45 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -1318,15 +1318,15 @@ void use_function_with_leak7() { // CHECK-NEXT: kindevent // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line46 -// CHECK-NEXT: col1 +// CHECK-NEXT: line45 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: depth0 // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'buf' @@ -1334,11 +1334,11 @@ void use_function_with_leak7() { // CHECK-NEXT: typeMemory leak // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contexttest_wrapper -// CHECK-NEXT: issue_hash3 +// CHECK-NEXT: issue_hash2 // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line46 -// CHECK-NEXT: col1 +// CHECK-NEXT: line45 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -1406,7 +1406,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'my_malloc_and_free' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'my_malloc_and_free' +// CHECK-NEXT: Calling 'my_malloc_and_free' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -1420,7 +1420,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'test_double_action_call' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'test_double_action_call' +// CHECK-NEXT: Entered call from 'test_double_action_call' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1517,7 +1517,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1614,7 +1614,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'my_free' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'my_free' +// CHECK-NEXT: Calling 'my_free' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -1628,7 +1628,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'my_malloc_and_free' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'my_malloc_and_free' +// CHECK-NEXT: Entered call from 'my_malloc_and_free' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1691,7 +1691,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is released // CHECK-NEXT: message -// CHECK-NEXT: Memory is released +// CHECK-NEXT: Memory is released // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -1720,7 +1720,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Returned released memory via 1st parameter // CHECK-NEXT: message -// CHECK-NEXT: Returned released memory via 1st parameter +// CHECK-NEXT: Returned released memory via 1st parameter // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1783,7 +1783,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Returned released memory via 1st parameter // CHECK-NEXT: message -// CHECK-NEXT: Returned released memory via 1st parameter +// CHECK-NEXT: Returned released memory via 1st parameter // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1846,7 +1846,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Use of memory after it is freed // CHECK-NEXT: message -// CHECK-NEXT: Use of memory after it is freed +// CHECK-NEXT: Use of memory after it is freed // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionUse of memory after it is freed @@ -1926,7 +1926,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -1989,7 +1989,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'my_realloc' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'my_realloc' +// CHECK-NEXT: Calling 'my_realloc' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -2003,7 +2003,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'reallocIntra' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'reallocIntra' +// CHECK-NEXT: Entered call from 'reallocIntra' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2134,7 +2134,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Attempt to reallocate memory // CHECK-NEXT: message -// CHECK-NEXT: Attempt to reallocate memory +// CHECK-NEXT: Attempt to reallocate memory // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2231,7 +2231,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Assuming 'tmp' is null // CHECK-NEXT: message -// CHECK-NEXT: Assuming 'tmp' is null +// CHECK-NEXT: Assuming 'tmp' is null // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2294,7 +2294,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Reallocation failed // CHECK-NEXT: message -// CHECK-NEXT: Reallocation failed +// CHECK-NEXT: Reallocation failed // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2357,7 +2357,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Reallocation of 1st parameter failed // CHECK-NEXT: message -// CHECK-NEXT: Reallocation of 1st parameter failed +// CHECK-NEXT: Reallocation of 1st parameter failed // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2405,7 +2405,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'buf' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'buf' @@ -2485,7 +2485,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'malloc_wrapper_ret' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'malloc_wrapper_ret' +// CHECK-NEXT: Calling 'malloc_wrapper_ret' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -2499,7 +2499,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_ret' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_ret' +// CHECK-NEXT: Entered call from 'use_ret' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2596,7 +2596,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -2625,7 +2625,41 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Returned allocated memory // CHECK-NEXT: message -// CHECK-NEXT: Returned allocated memory +// CHECK-NEXT: Returned allocated memory +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: kindcontrol +// CHECK-NEXT: edges +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: start +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line86 +// CHECK-NEXT: col5 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line86 +// CHECK-NEXT: col5 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: end +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line86 +// CHECK-NEXT: col9 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line86 +// CHECK-NEXT: col26 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2648,13 +2682,13 @@ void use_function_with_leak7() { // CHECK-NEXT: end // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line87 -// CHECK-NEXT: col1 +// CHECK-NEXT: line86 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line87 -// CHECK-NEXT: col1 +// CHECK-NEXT: line86 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -2665,15 +2699,15 @@ void use_function_with_leak7() { // CHECK-NEXT: kindevent // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line87 -// CHECK-NEXT: col1 +// CHECK-NEXT: line86 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: depth0 // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'v' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'v' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'v' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'v' @@ -2681,11 +2715,11 @@ void use_function_with_leak7() { // CHECK-NEXT: typeMemory leak // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contextuse_ret -// CHECK-NEXT: issue_hash3 +// CHECK-NEXT: issue_hash2 // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line87 -// CHECK-NEXT: col1 +// CHECK-NEXT: line86 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -2787,7 +2821,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2835,7 +2869,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'm' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'm' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'm' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'm' @@ -2881,7 +2915,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak1' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak1' +// CHECK-NEXT: Calling 'function_with_leak1' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -2895,7 +2929,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak1' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak1' +// CHECK-NEXT: Entered call from 'use_function_with_leak1' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -2992,7 +3026,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3040,7 +3074,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'x' @@ -3086,7 +3120,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak2' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak2' +// CHECK-NEXT: Calling 'function_with_leak2' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -3100,7 +3134,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak2' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak2' +// CHECK-NEXT: Entered call from 'use_function_with_leak2' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3197,7 +3231,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3245,7 +3279,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'x' @@ -3291,7 +3325,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak3' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak3' +// CHECK-NEXT: Calling 'function_with_leak3' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -3305,7 +3339,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak3' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak3' +// CHECK-NEXT: Entered call from 'use_function_with_leak3' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3402,7 +3436,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3499,7 +3533,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Assuming 'y' is not equal to 0 // CHECK-NEXT: message -// CHECK-NEXT: Assuming 'y' is not equal to 0 +// CHECK-NEXT: Assuming 'y' is not equal to 0 // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3547,7 +3581,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'x' @@ -3593,7 +3627,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak4' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak4' +// CHECK-NEXT: Calling 'function_with_leak4' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -3607,7 +3641,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak4' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak4' +// CHECK-NEXT: Entered call from 'use_function_with_leak4' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3704,7 +3738,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3801,7 +3835,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Assuming 'y' is 0 // CHECK-NEXT: message -// CHECK-NEXT: Assuming 'y' is 0 +// CHECK-NEXT: Assuming 'y' is 0 // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -3849,7 +3883,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'x' @@ -3895,7 +3929,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak5' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak5' +// CHECK-NEXT: Calling 'function_with_leak5' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -3909,7 +3943,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak5' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak5' +// CHECK-NEXT: Entered call from 'use_function_with_leak5' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -4006,7 +4040,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -4054,7 +4088,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'x' @@ -4100,7 +4134,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak6' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak6' +// CHECK-NEXT: Calling 'function_with_leak6' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -4114,7 +4148,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak6' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak6' +// CHECK-NEXT: Entered call from 'use_function_with_leak6' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -4211,7 +4245,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -4259,7 +4293,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' +// CHECK-NEXT: Memory is never released; potential leak of memory pointed to by 'x' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak of memory pointed to by 'x' @@ -4305,7 +4339,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Calling 'function_with_leak7' // CHECK-NEXT: message -// CHECK-NEXT: Calling 'function_with_leak7' +// CHECK-NEXT: Calling 'function_with_leak7' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -4319,7 +4353,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Entered call from 'use_function_with_leak7' // CHECK-NEXT: message -// CHECK-NEXT: Entered call from 'use_function_with_leak7' +// CHECK-NEXT: Entered call from 'use_function_with_leak7' // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindcontrol @@ -4416,7 +4450,7 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is allocated // CHECK-NEXT: message -// CHECK-NEXT: Memory is allocated +// CHECK-NEXT: Memory is allocated // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent @@ -4445,55 +4479,21 @@ void use_function_with_leak7() { // CHECK-NEXT: extended_message // CHECK-NEXT: Returned allocated memory // CHECK-NEXT: message -// CHECK-NEXT: Returned allocated memory -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: kindcontrol -// CHECK-NEXT: edges -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: start -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: line169 -// CHECK-NEXT: col5 -// CHECK-NEXT: file0 -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: line169 -// CHECK-NEXT: col23 -// CHECK-NEXT: file0 -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: end -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: line170 -// CHECK-NEXT: col1 -// CHECK-NEXT: file0 -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: line170 -// CHECK-NEXT: col1 -// CHECK-NEXT: file0 -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: -// CHECK-NEXT: +// CHECK-NEXT: Returned allocated memory // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: kindevent // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line170 -// CHECK-NEXT: col1 +// CHECK-NEXT: line169 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: depth0 // CHECK-NEXT: extended_message // CHECK-NEXT: Memory is never released; potential leak // CHECK-NEXT: message -// CHECK-NEXT: Memory is never released; potential leak +// CHECK-NEXT: Memory is never released; potential leak // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: descriptionMemory is never released; potential leak @@ -4501,11 +4501,11 @@ void use_function_with_leak7() { // CHECK-NEXT: typeMemory leak // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contextuse_function_with_leak7 -// CHECK-NEXT: issue_hash2 +// CHECK-NEXT: issue_hash1 // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line170 -// CHECK-NEXT: col1 +// CHECK-NEXT: line169 +// CHECK-NEXT: col5 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c index b939ac3..76dd3a8 100644 --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -1030,6 +1030,11 @@ void *test(void *ptr) { return newPtr; } + +char *testLeakWithinReturn(char *str) { + return strdup(strdup(str)); // expected-warning{{leak}} +} + // ---------------------------------------------------------------------------- // False negatives. diff --git a/clang/test/Analysis/plist-output-alternate.m b/clang/test/Analysis/plist-output-alternate.m index 423574d..7bb81be 100644 --- a/clang/test/Analysis/plist-output-alternate.m +++ b/clang/test/Analysis/plist-output-alternate.m @@ -1199,6 +1199,40 @@ void rdar8331641(int x) { // CHECK-NEXT: // CHECK-NEXT: // CHECK-NEXT: line57 +// CHECK-NEXT: col3 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: kindcontrol +// CHECK-NEXT: edges +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: start +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: end +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line57 // CHECK-NEXT: col10 // CHECK-NEXT: file0 // CHECK-NEXT: @@ -1232,13 +1266,13 @@ void rdar8331641(int x) { // CHECK-NEXT: end // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line58 -// CHECK-NEXT: col1 +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: -// CHECK-NEXT: line58 -// CHECK-NEXT: col1 +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: @@ -1249,10 +1283,25 @@ void rdar8331641(int x) { // CHECK-NEXT: kindevent // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line58 -// CHECK-NEXT: col1 +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: +// CHECK-NEXT: ranges +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: line57 +// CHECK-NEXT: col14 +// CHECK-NEXT: file0 +// CHECK-NEXT: +// CHECK-NEXT: +// CHECK-NEXT: // CHECK-NEXT: depth0 // CHECK-NEXT: extended_message // CHECK-NEXT: Object leaked: object allocated and stored into 'value' is not referenced later in this execution path and has a retain count of +1 @@ -1265,11 +1314,11 @@ void rdar8331641(int x) { // CHECK-NEXT: typeLeak // CHECK-NEXT: issue_context_kindfunction // CHECK-NEXT: issue_contextrdar8331641 -// CHECK-NEXT: issue_hash6 +// CHECK-NEXT: issue_hash5 // CHECK-NEXT: location // CHECK-NEXT: -// CHECK-NEXT: line58 -// CHECK-NEXT: col1 +// CHECK-NEXT: line57 +// CHECK-NEXT: col3 // CHECK-NEXT: file0 // CHECK-NEXT: // CHECK-NEXT: -- 2.7.4