From 4f64b38f561a7dfab1cbb7514f1bfdacbc7e8bad Mon Sep 17 00:00:00 2001 From: George Karpenkov Date: Thu, 10 Jan 2019 18:15:57 +0000 Subject: [PATCH] [analyzer] Quote the type of the leaked/problematic object in diagnostics for readability Differential Revision: https://reviews.llvm.org/D56344 llvm-svn: 350867 --- .../RetainCountDiagnostics.cpp | 17 +- .../Inputs/expected-plists/edges-new.mm.plist | 4 +- .../Inputs/expected-plists/objc-arc.m.plist | 26 +- .../objc-radar17039661.m.plist | 2426 +++++++++-------- .../plist-output-alternate.m.plist | 4 +- .../retain-release-path-notes.m.plist | 38 +- clang/test/Analysis/objc-radar17039661.m | 1276 +-------- .../test/Analysis/osobject-retain-release.cpp | 32 +- clang/test/Analysis/retain-release-arc.m | 2 +- .../test/Analysis/retain-release-path-notes.m | 18 +- .../retaincountchecker-compoundregion.m | 4 +- 11 files changed, 1305 insertions(+), 2542 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp index 0f01d9a99546..1f370fc301b5 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp @@ -157,14 +157,14 @@ static void generateDiagnosticsForCallLike(ProgramStateRef CurrSt, } if (CurrV.getObjKind() == ObjKind::CF) { - os << " returns a Core Foundation object of type " - << Sym->getType().getAsString() << " with a "; + os << " a Core Foundation object of type '" + << Sym->getType().getAsString() << "' with a "; } else if (CurrV.getObjKind() == ObjKind::OS) { - os << " returns an OSObject of type " << getPrettyTypeName(Sym->getType()) - << " with a "; + os << " an OSObject of type '" << getPrettyTypeName(Sym->getType()) + << "' with a "; } else if (CurrV.getObjKind() == ObjKind::Generalized) { - os << " returns an object of type " << Sym->getType().getAsString() - << " with a "; + os << " an object of type '" << Sym->getType().getAsString() + << "' with a "; } else { assert(CurrV.getObjKind() == ObjKind::ObjC); QualType T = Sym->getType(); @@ -587,7 +587,8 @@ CFRefLeakReportVisitor::getEndPath(BugReporterContext &BRC, if (RegionDescription) { os << "object allocated and stored into '" << *RegionDescription << '\''; } else { - os << "allocated object of type " << getPrettyTypeName(Sym->getType()); + os << "allocated object of type '" << getPrettyTypeName(Sym->getType()) + << "'"; } // Get the retain count. @@ -724,7 +725,7 @@ void CFRefLeakReport::createDescription(CheckerContext &Ctx) { } else { // If we can't figure out the name, just supply the type information. - os << " of type " << getPrettyTypeName(Sym->getType()); + os << " of type '" << getPrettyTypeName(Sym->getType()) << "'"; } } diff --git a/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist b/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist index b5f5d6e60446..449050d5955e 100644 --- a/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist +++ b/clang/test/Analysis/Inputs/expected-plists/edges-new.mm.plist @@ -1933,9 +1933,9 @@ depth0 extended_message - Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count + Call to function 'CFNumberCreate' returns a Core Foundation object of type 'CFNumberRef' with a +1 retain count message - Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count + Call to function 'CFNumberCreate' returns a Core Foundation object of type 'CFNumberRef' with a +1 retain count kindcontrol diff --git a/clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist b/clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist index 3f9d63e7a635..966ea9ac0941 100644 --- a/clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/objc-arc.m.plist @@ -223,9 +223,9 @@ depth0 extended_message - Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count + Call to function 'CFDateCreate' returns a Core Foundation object of type 'CFDateRef' with a +1 retain count message - Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count + Call to function 'CFDateCreate' returns a Core Foundation object of type 'CFDateRef' with a +1 retain count kindcontrol @@ -739,9 +739,9 @@ depth0 extended_message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count kindcontrol @@ -934,9 +934,9 @@ depth0 extended_message - Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count + Call to function 'CFCreateString' returns a Core Foundation object of type 'CFStringRef' with a +1 retain count message - Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count + Call to function 'CFCreateString' returns a Core Foundation object of type 'CFStringRef' with a +1 retain count kindcontrol @@ -1353,9 +1353,9 @@ depth0 extended_message - Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count + Call to function 'CFDateCreate' returns a Core Foundation object of type 'CFDateRef' with a +1 retain count message - Call to function 'CFDateCreate' returns a Core Foundation object of type CFDateRef with a +1 retain count + Call to function 'CFDateCreate' returns a Core Foundation object of type 'CFDateRef' with a +1 retain count kindcontrol @@ -1679,9 +1679,9 @@ depth0 extended_message - Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count + Call to function 'CFCreateString' returns a Core Foundation object of type 'CFStringRef' with a +1 retain count message - Call to function 'CFCreateString' returns a Core Foundation object of type CFStringRef with a +1 retain count + Call to function 'CFCreateString' returns a Core Foundation object of type 'CFStringRef' with a +1 retain count kindcontrol @@ -1727,12 +1727,12 @@ depth0 extended_message - Object leaked: allocated object of type CFStringRef is not referenced later in this execution path and has a retain count of +1 + Object leaked: allocated object of type 'CFStringRef' is not referenced later in this execution path and has a retain count of +1 message - Object leaked: allocated object of type CFStringRef is not referenced later in this execution path and has a retain count of +1 + Object leaked: allocated object of type 'CFStringRef' is not referenced later in this execution path and has a retain count of +1 - descriptionPotential leak of an object of type CFStringRef + descriptionPotential leak of an object of type 'CFStringRef' categoryMemory (Core Foundation/Objective-C) typeLeak check_nameosx.cocoa.RetainCount diff --git a/clang/test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist b/clang/test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist index 1cfbbbd5adc7..b5b26d050e36 100644 --- a/clang/test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/objc-radar17039661.m.plist @@ -1,1275 +1,1309 @@ -diagnostics - - - path - - - kindcontrol - edges - - - start - - - line48 - col3 - file0 - - - line48 - col15 - file0 - - - end - - - line49 - col3 - file0 - - - line49 - col6 - file0 - - - - - - - kindcontrol - edges - - - start - - - line49 - col3 - file0 - - - line49 - col6 - file0 - - - end - - - line49 - col26 - file0 - - - line49 - col38 - file0 - - - - - - - kindevent - location + + + + + clang_version +clang version 8.0.0 + diagnostics + + + path + - line49 - col26 - file0 - - ranges - + kindcontrol + edges - line49 - col26 - file0 - - - line53 - col4 - file0 + start + + + line49 + col3 + file0 + + + line49 + col15 + file0 + + + end + + + line50 + col3 + file0 + + + line50 + col6 + file0 + + - - depth0 - extended_message - Calling 'performAction' - message - Calling 'performAction' - - - kindevent - location - - line27 - col1 - file0 - depth1 - extended_message - Entered call from 'runTest' - message - Entered call from 'runTest' - - - kindcontrol - edges - - - start - - - line27 - col1 - file0 - - - line27 - col6 - file0 - - - end - - - line28 - col3 - file0 - - - line28 - col15 - file0 - - - - - - - kindcontrol - edges - - - start - - - line28 - col3 - file0 - - - line28 - col15 - file0 - - - end - - - line29 - col3 - file0 - - - line29 - col21 - file0 - - - - - - - kindevent - location - line29 - col3 - file0 - - ranges - + kindcontrol + edges - line29 - col3 - file0 - - - line43 - col4 - file0 + start + + + line50 + col3 + file0 + + + line50 + col6 + file0 + + + end + + + line50 + col26 + file0 + + + line50 + col38 + file0 + + - - depth1 - extended_message - Calling 'reallyPerformAction' - message - Calling 'reallyPerformAction' - - - kindevent - location - - line22 - col1 - file0 - depth2 - extended_message - Entered call from 'performAction' - message - Entered call from 'performAction' - - - kindcontrol - edges + + kindevent + location + + line50 + col26 + file0 + + ranges - - start - - - line22 - col1 - file0 - - - line22 - col6 - file0 - - - end - - - line23 - col3 - file0 - - - line23 - col16 - file0 - - - + + + line50 + col26 + file0 + + + line54 + col4 + file0 + + - - - kindevent - location - - line23 - col3 - file0 + depth0 + extended_message + Calling 'performAction' + message + Calling 'performAction' - ranges - + + kindevent + location + + line28 + col1 + file0 + + depth1 + extended_message + Entered call from 'runTest' + message + Entered call from 'runTest' + + + kindcontrol + edges - line23 - col3 - file0 - - - line23 - col58 - file0 + start + + + line28 + col1 + file0 + + + line28 + col6 + file0 + + + end + + + line29 + col3 + file0 + + + line29 + col15 + file0 + + - - depth2 - extended_message - Calling anonymous block - message - Calling anonymous block - - - kindevent - location - - line29 - col23 - file0 - depth3 - extended_message - Entered call from 'reallyPerformAction' - message - Entered call from 'reallyPerformAction' - - - kindcontrol - edges - - - start - - - line29 - col23 - file0 - - - line29 - col23 - file0 - - - end - - - line31 - col5 - file0 - - - line31 - col6 - file0 - - - - - - - kindcontrol - edges - - - start - - - line31 - col5 - file0 - - - line31 - col6 - file0 - - - end - - - line31 - col9 - file0 - - - line31 - col12 - file0 - - - - - - - kindevent - location - line31 - col9 - file0 - - ranges - + kindcontrol + edges - line31 - col9 - file0 - - - line31 - col12 - file0 + start + + + line29 + col3 + file0 + + + line29 + col15 + file0 + + + end + + + line30 + col3 + file0 + + + line30 + col21 + file0 + + - - depth3 - extended_message - Assuming 'cond' is not equal to 0 - message - Assuming 'cond' is not equal to 0 - - - kindcontrol - edges - - - start - - - line31 - col9 - file0 - - - line31 - col12 - file0 - - - end - - - line33 - col7 - file0 - - - line33 - col14 - file0 - - - - - - - kindevent - location - - line33 - col30 - file0 - ranges - + + kindevent + location + + line30 + col3 + file0 + + ranges + + + + line30 + col3 + file0 + + + line44 + col4 + file0 + + + + depth1 + extended_message + Calling 'reallyPerformAction' + message + Calling 'reallyPerformAction' + + + kindevent + location + + line23 + col1 + file0 + + depth2 + extended_message + Entered call from 'performAction' + message + Entered call from 'performAction' + + + kindcontrol + edges - line33 - col30 - file0 - - - line33 - col50 - file0 + start + + + line23 + col1 + file0 + + + line23 + col6 + file0 + + + end + + + line24 + col3 + file0 + + + line24 + col16 + file0 + + - - depth3 - extended_message - NSNumber boxed expression produces an object with a +0 retain count - message - NSNumber boxed expression produces an object with a +0 retain count - - - kindcontrol - edges - - - start - - - line33 - col7 - file0 - - - line33 - col14 - file0 - - - end - - - line35 - col7 - file0 - - - line35 - col14 - file0 - - - - - - - kindcontrol - edges - - - start - - - line35 - col7 - file0 - - - line35 - col14 - file0 - - - end - - - line35 - col33 - file0 - - - line35 - col38 - file0 - - - - - - - kindevent - location - - line35 - col33 - file0 - ranges - + + kindevent + location + + line24 + col3 + file0 + + ranges + + + + line24 + col3 + file0 + + + line24 + col58 + file0 + + + + depth2 + extended_message + Calling anonymous block + message + Calling anonymous block + + + kindevent + location + + line30 + col23 + file0 + + depth3 + extended_message + Entered call from 'reallyPerformAction' + message + Entered call from 'reallyPerformAction' + + + kindcontrol + edges - line35 - col33 - file0 - - - line35 - col50 - file0 + start + + + line30 + col23 + file0 + + + line30 + col23 + file0 + + + end + + + line32 + col5 + file0 + + + line32 + col6 + file0 + + - - depth3 - extended_message - Calling anonymous block - message - Calling anonymous block - - - kindevent - location - - line49 - col40 - file0 - depth4 - extended_message - Entered call - message - Entered call - - - kindcontrol - edges - - - start - - - line49 - col40 - file0 - - - line49 - col40 - file0 - - - end - - - line50 - col5 - file0 - - - line50 - col17 - file0 - - - - - - - kindevent - location - line50 - col21 - file0 - - ranges - + kindcontrol + edges - line50 - col21 - file0 - - - line50 - col39 - file0 + start + + + line32 + col5 + file0 + + + line32 + col6 + file0 + + + end + + + line32 + col9 + file0 + + + line32 + col12 + file0 + + + + + kindevent + location + + line32 + col9 + file0 + + ranges + + + + line32 + col9 + file0 + + + line32 + col12 + file0 + + + + depth3 + extended_message + Assuming 'cond' is not equal to 0 + message + Assuming 'cond' is not equal to 0 + + + kindcontrol + edges - line50 - col22 - file0 - - - line50 - col31 - file0 + start + + + line32 + col9 + file0 + + + line32 + col12 + file0 + + + end + + + line34 + col7 + file0 + + + line34 + col14 + file0 + + - - depth4 - extended_message - Reference count incremented. The object now has a +1 retain count - message - Reference count incremented. The object now has a +1 retain count - - - kindcontrol - edges - - - start - - - line50 - col5 - file0 - - - line50 - col17 - file0 - - - end - - - line52 - col5 - file0 - - - line52 - col10 - file0 - - - - - - - kindevent - location - - line35 - col33 - file0 - ranges - + + kindevent + location + + line34 + col30 + file0 + + ranges + + + + line34 + col30 + file0 + + + line34 + col50 + file0 + + + + depth3 + extended_message + NSNumber boxed expression produces an object with a +0 retain count + message + NSNumber boxed expression produces an object with a +0 retain count + + + kindcontrol + edges - line35 - col33 - file0 - - - line35 - col50 - file0 + start + + + line34 + col7 + file0 + + + line34 + col14 + file0 + + + end + + + line36 + col7 + file0 + + + line36 + col14 + file0 + + - - depth3 - extended_message - Returning to caller - message - Returning to caller - - - kindcontrol - edges - - - start - - - line35 - col33 - file0 - - - line35 - col38 - file0 - - - end - - - line35 - col7 - file0 - - - line35 - col14 - file0 - - - - - - - kindcontrol - edges - - - start - - - line35 - col7 - file0 - - - line35 - col14 - file0 - - - end - - - line37 - col7 - file0 - - - line37 - col8 - file0 - - - - - - - kindcontrol - edges - - - start - - - line37 - col7 - file0 - - - line37 - col8 - file0 - - - end - - - line40 - col7 - file0 - - - line40 - col18 - file0 - - - - - - - kindevent - location - - line23 - col3 - file0 - ranges - + + kindcontrol + edges - line23 - col3 - file0 - - - line23 - col58 - file0 + start + + + line36 + col7 + file0 + + + line36 + col14 + file0 + + + end + + + line36 + col33 + file0 + + + line36 + col38 + file0 + + - - depth2 - extended_message - Returning to caller - message - Returning to caller - - - kindcontrol - edges - - - start - - - line23 - col3 - file0 - - - line23 - col16 - file0 - - - end - - - line24 - col3 - file0 - - - line24 - col16 - file0 - - - - - - - kindevent - location - - line24 - col3 - file0 - ranges - + + kindevent + location + + line36 + col33 + file0 + + ranges + + + + line36 + col33 + file0 + + + line36 + col50 + file0 + + + + depth3 + extended_message + Calling anonymous block + message + Calling anonymous block + + + kindevent + location + + line50 + col40 + file0 + + depth4 + extended_message + Entered call + message + Entered call + + + kindcontrol + edges - line24 - col3 - file0 - - - line24 - col58 - file0 + start + + + line50 + col40 + file0 + + + line50 + col40 + file0 + + + end + + + line51 + col5 + file0 + + + line51 + col17 + file0 + + - - depth2 - extended_message - Calling anonymous block - message - Calling anonymous block - - - kindevent - location - - line29 - col23 - file0 - depth3 - extended_message - Entered call from 'reallyPerformAction' - message - Entered call from 'reallyPerformAction' - - - kindcontrol - edges - - - start - - - line29 - col23 - file0 - - - line29 - col23 - file0 - - - end - - - line31 - col5 - file0 - - - line31 - col6 - file0 - - - - - - - kindcontrol - edges - - - start - - - line31 - col5 - file0 - - - line31 - col6 - file0 - - - end - - - line31 - col9 - file0 - - - line31 - col12 - file0 - - - - - - - kindevent - location - line31 - col9 - file0 + kindevent + location + + line51 + col21 + file0 + + ranges + + + + line51 + col21 + file0 + + + line51 + col39 + file0 + + + + + line51 + col22 + file0 + + + line51 + col31 + file0 + + + + depth4 + extended_message + Reference count incremented. The object now has a +1 retain count + message + Reference count incremented. The object now has a +1 retain count - ranges - + + kindcontrol + edges - line31 - col9 - file0 - - - line31 - col12 - file0 + start + + + line51 + col5 + file0 + + + line51 + col17 + file0 + + + end + + + line53 + col5 + file0 + + + line53 + col10 + file0 + + - - depth3 - extended_message - Assuming 'cond' is not equal to 0 - message - Assuming 'cond' is not equal to 0 - - - kindcontrol - edges - - - start - - - line31 - col9 - file0 - - - line31 - col12 - file0 - - - end - - - line33 - col7 - file0 - - - line33 - col14 - file0 - - - - - - - kindcontrol - edges - - - start - - - line33 - col7 - file0 - - - line33 - col14 - file0 - - - end - - - line35 - col7 - file0 - - - line35 - col14 - file0 - - - - - - - kindcontrol - edges - - - start - - - line35 - col7 - file0 - - - line35 - col14 - file0 - - - end - - - line35 - col33 - file0 - - - line35 - col38 - file0 - - - - - - - kindevent - location - - line35 - col33 - file0 - ranges - + + kindevent + location + + line36 + col33 + file0 + + ranges + + + + line36 + col33 + file0 + + + line36 + col50 + file0 + + + + depth3 + extended_message + Returning to caller + message + Returning to caller + + + kindcontrol + edges - line35 - col33 - file0 - - - line35 - col50 - file0 + start + + + line36 + col33 + file0 + + + line36 + col38 + file0 + + + end + + + line36 + col7 + file0 + + + line36 + col14 + file0 + + - - depth3 - extended_message - Calling anonymous block - message - Calling anonymous block - - - kindevent - location - - line49 - col40 - file0 - depth4 - extended_message - Entered call - message - Entered call - - - kindcontrol - edges - - - start - - - line49 - col40 - file0 - - - line49 - col40 - file0 - - - end - - - line50 - col5 - file0 - - - line50 - col17 - file0 - - - - - - - kindcontrol - edges - - - start - - - line50 - col5 - file0 - - - line50 - col17 - file0 - - - end - - - line52 - col5 - file0 - - - line52 - col10 - file0 - - - - - - - kindevent - location - line52 - col5 - file0 - - ranges - + kindcontrol + edges - line52 - col5 - file0 - - - line52 - col21 - file0 + start + + + line36 + col7 + file0 + + + line36 + col14 + file0 + + + end + + + line38 + col7 + file0 + + + line38 + col8 + file0 + + - - depth4 - extended_message - Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1 - message - Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1 - - - descriptionPotential leak of an object - categoryMemory (Core Foundation/Objective-C) - typeLeak - location - - line52 - col5 - file0 - - - - + + + kindcontrol + edges + + + start + + + line38 + col7 + file0 + + + line38 + col8 + file0 + + + end + + + line41 + col7 + file0 + + + line41 + col18 + file0 + + + + + + + kindevent + location + + line24 + col3 + file0 + + ranges + + + + line24 + col3 + file0 + + + line24 + col58 + file0 + + + + depth2 + extended_message + Returning to caller + message + Returning to caller + + + kindcontrol + edges + + + start + + + line24 + col3 + file0 + + + line24 + col16 + file0 + + + end + + + line25 + col3 + file0 + + + line25 + col16 + file0 + + + + + + + kindevent + location + + line25 + col3 + file0 + + ranges + + + + line25 + col3 + file0 + + + line25 + col58 + file0 + + + + depth2 + extended_message + Calling anonymous block + message + Calling anonymous block + + + kindevent + location + + line30 + col23 + file0 + + depth3 + extended_message + Entered call from 'reallyPerformAction' + message + Entered call from 'reallyPerformAction' + + + kindcontrol + edges + + + start + + + line30 + col23 + file0 + + + line30 + col23 + file0 + + + end + + + line32 + col5 + file0 + + + line32 + col6 + file0 + + + + + + + kindcontrol + edges + + + start + + + line32 + col5 + file0 + + + line32 + col6 + file0 + + + end + + + line32 + col9 + file0 + + + line32 + col12 + file0 + + + + + + + kindevent + location + + line32 + col9 + file0 + + ranges + + + + line32 + col9 + file0 + + + line32 + col12 + file0 + + + + depth3 + extended_message + Assuming 'cond' is not equal to 0 + message + Assuming 'cond' is not equal to 0 + + + kindcontrol + edges + + + start + + + line32 + col9 + file0 + + + line32 + col12 + file0 + + + end + + + line34 + col7 + file0 + + + line34 + col14 + file0 + + + + + + + kindcontrol + edges + + + start + + + line34 + col7 + file0 + + + line34 + col14 + file0 + + + end + + + line36 + col7 + file0 + + + line36 + col14 + file0 + + + + + + + kindcontrol + edges + + + start + + + line36 + col7 + file0 + + + line36 + col14 + file0 + + + end + + + line36 + col33 + file0 + + + line36 + col38 + file0 + + + + + + + kindevent + location + + line36 + col33 + file0 + + ranges + + + + line36 + col33 + file0 + + + line36 + col50 + file0 + + + + depth3 + extended_message + Calling anonymous block + message + Calling anonymous block + + + kindevent + location + + line50 + col40 + file0 + + depth4 + extended_message + Entered call + message + Entered call + + + kindcontrol + edges + + + start + + + line50 + col40 + file0 + + + line50 + col40 + file0 + + + end + + + line51 + col5 + file0 + + + line51 + col17 + file0 + + + + + + + kindcontrol + edges + + + start + + + line51 + col5 + file0 + + + line51 + col17 + file0 + + + end + + + line53 + col5 + file0 + + + line53 + col10 + file0 + + + + + + + kindevent + location + + line53 + col5 + file0 + + ranges + + + + line53 + col5 + file0 + + + line53 + col21 + file0 + + + + depth4 + extended_message + Object leaked: allocated object of type 'NSNumber *' is not referenced later in this execution path and has a retain count of +1 + message + Object leaked: allocated object of type 'NSNumber *' is not referenced later in this execution path and has a retain count of +1 + + + descriptionPotential leak of an object of type 'NSNumber *' + categoryMemory (Core Foundation/Objective-C) + typeLeak + check_nameosx.cocoa.RetainCount + + issue_hash_content_of_line_in_context500e2bbda41c8086771ad98b6bcfdc50 + location + + line53 + col5 + file0 + + ExecutedLines + + 0 + + 23 + 24 + 25 + 28 + 29 + 30 + 32 + 34 + 36 + 38 + 41 + 48 + 49 + 50 + 51 + 53 + + + + + files + + /Volumes/Transcend/code/monorepo/llvm-project/clang/test/Analysis/objc-radar17039661.m + - + \ No newline at end of file diff --git a/clang/test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist b/clang/test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist index b3383375dc2c..966d5a7bce0c 100644 --- a/clang/test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/plist-output-alternate.m.plist @@ -1299,9 +1299,9 @@ depth0 extended_message - Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count + Call to function 'CFNumberCreate' returns a Core Foundation object of type 'CFNumberRef' with a +1 retain count message - Call to function 'CFNumberCreate' returns a Core Foundation object of type CFNumberRef with a +1 retain count + Call to function 'CFNumberCreate' returns a Core Foundation object of type 'CFNumberRef' with a +1 retain count kindcontrol diff --git a/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist b/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist index f7ff277b544a..13b654a19c69 100644 --- a/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/retain-release-path-notes.m.plist @@ -155,9 +155,9 @@ depth0 extended_message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count kindcontrol @@ -822,9 +822,9 @@ depth0 extended_message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count kindcontrol @@ -1883,9 +1883,9 @@ depth0 extended_message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count kindcontrol @@ -2006,9 +2006,9 @@ depth0 extended_message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count kindcontrol @@ -2127,9 +2127,9 @@ depth0 extended_message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count kindcontrol @@ -3834,12 +3834,12 @@ depth0 extended_message - Object leaked: allocated object of type MyObj * is not referenced later in this execution path and has a retain count of +1 + Object leaked: allocated object of type 'MyObj *' is not referenced later in this execution path and has a retain count of +1 message - Object leaked: allocated object of type MyObj * is not referenced later in this execution path and has a retain count of +1 + Object leaked: allocated object of type 'MyObj *' is not referenced later in this execution path and has a retain count of +1 - descriptionPotential leak of an object of type MyObj * + descriptionPotential leak of an object of type 'MyObj *' categoryMemory (Core Foundation/Objective-C) typeLeak check_nameosx.cocoa.RetainCount @@ -4298,9 +4298,9 @@ depth0 extended_message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count message - Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count + Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count kindcontrol @@ -4571,9 +4571,9 @@ depth0 extended_message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count kindcontrol @@ -4768,9 +4768,9 @@ depth0 extended_message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count message - Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count + Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count kindcontrol diff --git a/clang/test/Analysis/objc-radar17039661.m b/clang/test/Analysis/objc-radar17039661.m index 5f7c531eaeb7..484e43c5dd2c 100644 --- a/clang/test/Analysis/objc-radar17039661.m +++ b/clang/test/Analysis/objc-radar17039661.m @@ -1,6 +1,7 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount -fblocks -verify %s // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount -fblocks -analyzer-output=plist-multi-file %s -o %t -// RUN: FileCheck --input-file=%t %s +// RUN: cat %t | %diff_plist %S/Inputs/expected-plists/objc-radar17039661.m.plist - + @class NSString; typedef long NSInteger; typedef unsigned char BOOL; @@ -58,1276 +59,3 @@ void runTest() { return; } } - -// CHECK: diagnostics -// CHECK: -// CHECK: -// CHECK: path -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line48 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line48 -// CHECK: col15 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col26 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col38 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line49 -// CHECK: col26 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col26 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line53 -// CHECK: col4 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth0 -// CHECK: extended_message -// CHECK: Calling 'performAction' -// CHECK: message -// CHECK: Calling 'performAction' -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line27 -// CHECK: col1 -// CHECK: file0 -// CHECK: -// CHECK: depth1 -// CHECK: extended_message -// CHECK: Entered call from 'runTest' -// CHECK: message -// CHECK: Entered call from 'runTest' -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line27 -// CHECK: col1 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line27 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line28 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line28 -// CHECK: col15 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line28 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line28 -// CHECK: col15 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col21 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line29 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line43 -// CHECK: col4 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth1 -// CHECK: extended_message -// CHECK: Calling 'reallyPerformAction' -// CHECK: message -// CHECK: Calling 'reallyPerformAction' -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line22 -// CHECK: col1 -// CHECK: file0 -// CHECK: -// CHECK: depth2 -// CHECK: extended_message -// CHECK: Entered call from 'performAction' -// CHECK: message -// CHECK: Entered call from 'performAction' -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line22 -// CHECK: col1 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line22 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col16 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line23 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col58 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth2 -// CHECK: extended_message -// CHECK: Calling anonymous block -// CHECK: message -// CHECK: Calling anonymous block -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line29 -// CHECK: col23 -// CHECK: file0 -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Entered call from 'reallyPerformAction' -// CHECK: message -// CHECK: Entered call from 'reallyPerformAction' -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col23 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col23 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line33 -// CHECK: col30 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col30 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col50 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: NSNumber boxed expression produces an object with a +0 retain count -// CHECK: message -// CHECK: NSNumber boxed expression produces an object with a +0 retain count -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col38 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col50 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Calling anonymous block -// CHECK: message -// CHECK: Calling anonymous block -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line49 -// CHECK: col40 -// CHECK: file0 -// CHECK: -// CHECK: depth4 -// CHECK: extended_message -// CHECK: Entered call -// CHECK: message -// CHECK: Entered call -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col40 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col40 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col17 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line50 -// CHECK: col21 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col21 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col39 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col22 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col31 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth4 -// CHECK: extended_message -// CHECK: Reference count incremented. The object now has a +1 retain count -// CHECK: message -// CHECK: Reference count incremented. The object now has a +1 retain count -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col17 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line52 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line52 -// CHECK: col10 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col50 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Returning to caller -// CHECK: message -// CHECK: Returning to caller -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col38 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line37 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line37 -// CHECK: col8 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line37 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line37 -// CHECK: col8 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line40 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line40 -// CHECK: col18 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line23 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col58 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth2 -// CHECK: extended_message -// CHECK: Returning to caller -// CHECK: message -// CHECK: Returning to caller -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line23 -// CHECK: col16 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line24 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line24 -// CHECK: col16 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line24 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line24 -// CHECK: col3 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line24 -// CHECK: col58 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth2 -// CHECK: extended_message -// CHECK: Calling anonymous block -// CHECK: message -// CHECK: Calling anonymous block -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line29 -// CHECK: col23 -// CHECK: file0 -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Entered call from 'reallyPerformAction' -// CHECK: message -// CHECK: Entered call from 'reallyPerformAction' -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col23 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line29 -// CHECK: col23 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col6 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: message -// CHECK: Assuming 'cond' is not equal to 0 -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col9 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line31 -// CHECK: col12 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line33 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col7 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col14 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col38 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col33 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line35 -// CHECK: col50 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth3 -// CHECK: extended_message -// CHECK: Calling anonymous block -// CHECK: message -// CHECK: Calling anonymous block -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line49 -// CHECK: col40 -// CHECK: file0 -// CHECK: -// CHECK: depth4 -// CHECK: extended_message -// CHECK: Entered call -// CHECK: message -// CHECK: Entered call -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col40 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line49 -// CHECK: col40 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col17 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindcontrol -// CHECK: edges -// CHECK: -// CHECK: -// CHECK: start -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line50 -// CHECK: col17 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: end -// CHECK: -// CHECK: -// CHECK: line52 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line52 -// CHECK: col10 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: -// CHECK: kindevent -// CHECK: location -// CHECK: -// CHECK: line52 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: ranges -// CHECK: -// CHECK: -// CHECK: -// CHECK: line52 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: line52 -// CHECK: col21 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: -// CHECK: depth4 -// CHECK: extended_message -// CHECK: Object leaked: allocated object of type NSNumber * is not referenced later in this execution path and has a retain count of +1 -// CHECK: message -// CHECK: Object leaked: allocated object of type NSNumber * is not referenced later in this execution path and has a retain count of +1 -// CHECK: -// CHECK: -// CHECK: descriptionPotential leak of an object of type NSNumber * -// CHECK: categoryMemory (Core Foundation/Objective-C) -// CHECK: typeLeak -// CHECK: location -// CHECK: -// CHECK: line52 -// CHECK: col5 -// CHECK: file0 -// CHECK: -// CHECK: -// CHECK: diff --git a/clang/test/Analysis/osobject-retain-release.cpp b/clang/test/Analysis/osobject-retain-release.cpp index 1fc5e31aa576..ca8a45c37f39 100644 --- a/clang/test/Analysis/osobject-retain-release.cpp +++ b/clang/test/Analysis/osobject-retain-release.cpp @@ -117,14 +117,14 @@ void os_consume_ok(OS_CONSUME OSObject *obj) { } void use_os_consume_violation() { - OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type OSObject with a +1 retain count}} + OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObject' with a +1 retain count}} os_consume_violation(obj); // expected-note{{Calling 'os_consume_violation'}} // expected-note@-1{{Returning from 'os_consume_violation'}} } // expected-note{{Object leaked: object allocated and stored into 'obj' is not referenced later in this execution path and has a retain count of +1}} // expected-warning@-1{{Potential leak of an object stored into 'obj'}} void use_os_consume_violation_two_args() { - OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type OSObject with a +1 retain count}} + OSObject *obj = new OSObject; // expected-note{{Operator 'new' returns an OSObject of type 'OSObject' with a +1 retain count}} os_consume_violation_two_args(obj, coin()); // expected-note{{Calling 'os_consume_violation_two_args'}} // expected-note@-1{{Returning from 'os_consume_violation_two_args'}} } // expected-note{{Object leaked: object allocated and stored into 'obj' is not referenced later in this execution path and has a retain count of +1}} @@ -195,7 +195,7 @@ void check_free_no_error() { } void check_free_use_after_free() { - OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} arr->retain(); // expected-note{{Reference count incremented. The object now has a +2 retain count}} arr->free(); // expected-note{{Object released}} arr->retain(); // expected-warning{{Reference-counted object is used after it is released}} @@ -203,13 +203,13 @@ void check_free_use_after_free() { } unsigned int check_leak_explicit_new() { - OSArray *arr = new OSArray; // expected-note{{Operator 'new' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = new OSArray; // expected-note{{Operator 'new' returns an OSObject of type 'OSArray' with a +1 retain count}} return arr->getCount(); // expected-note{{Object leaked: object allocated and stored into 'arr' is not referenced later in this execution path and has a retain count of +1}} // expected-warning@-1{{Potential leak of an object stored into 'arr'}} } unsigned int check_leak_factory() { - OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} return arr->getCount(); // expected-note{{Object leaked: object allocated and stored into 'arr' is not referenced later in this execution path and has a retain count of +1}} // expected-warning@-1{{Potential leak of an object stored into 'arr'}} } @@ -228,18 +228,18 @@ void check_custom_iterator_rule(OSArray *arr) { } void check_iterator_leak(OSArray *arr) { - arr->getIterator(); // expected-note{{Call to method 'OSArray::getIterator' returns an OSObject of type OSIterator with a +1 retain count}} -} // expected-note{{Object leaked: allocated object of type OSIterator is not referenced later}} - // expected-warning@-1{{Potential leak of an object of type OSIterator}} + arr->getIterator(); // expected-note{{Call to method 'OSArray::getIterator' returns an OSObject of type 'OSIterator' with a +1 retain count}} +} // expected-note{{Object leaked: allocated object of type 'OSIterator' is not referenced later}} + // expected-warning@-1{{Potential leak of an object of type 'OSIterator}}' void check_no_invalidation() { - OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} OtherStruct::doNothingToArray(arr); } // expected-warning{{Potential leak of an object stored into 'arr'}} // expected-note@-1{{Object leaked}} void check_no_invalidation_other_struct() { - OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} OtherStruct other(arr); // expected-warning{{Potential leak}} // expected-note@-1{{Object leaked}} } @@ -266,8 +266,8 @@ struct ArrayOwner : public OSObject { }; OSArray *generateArray() { - return OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} - // expected-note@-1{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + return OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} + // expected-note@-1{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} } unsigned int check_leak_good_error_message() { @@ -285,7 +285,7 @@ unsigned int check_leak_msg_temporary() { return generateArray()->getCount(); // expected-warning{{Potential leak of an object}} // expected-note@-1{{Calling 'generateArray'}} // expected-note@-2{{Returning from 'generateArray'}} - // expected-note@-3{{Object leaked: allocated object of type OSArray is not referenced later in this execution path and has a retain count of +1}} + // expected-note@-3{{Object leaked: allocated object of type 'OSArray' is not referenced later in this execution path and has a retain count of +1}} } void check_confusing_getters() { @@ -354,14 +354,14 @@ void check_dynamic_cast_null_check() { } void use_after_release() { - OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} arr->release(); // expected-note{{Object released}} arr->getCount(); // expected-warning{{Reference-counted object is used after it is released}} // expected-note@-1{{Reference-counted object is used after it is released}} } void potential_leak() { - OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type OSArray with a +1 retain count}} + OSArray *arr = OSArray::withCapacity(10); // expected-note{{Call to method 'OSArray::withCapacity' returns an OSObject of type 'OSArray' with a +1 retain count}} arr->retain(); // expected-note{{Reference count incremented. The object now has a +2 retain count}} arr->release(); // expected-note{{Reference count decremented. The object now has a +1 retain count}} arr->getCount(); @@ -412,7 +412,7 @@ unsigned int no_warn_ok_release(ArrayOwner *owner) { } unsigned int warn_on_overrelease_with_unknown_source(ArrayOwner *owner) { - OSArray *arr = owner->getArraySourceUnknown(); // expected-note{{Call to method 'ArrayOwner::getArraySourceUnknown' returns an OSObject of type OSArray with a +0 retain count}} + OSArray *arr = owner->getArraySourceUnknown(); // expected-note{{Call to method 'ArrayOwner::getArraySourceUnknown' returns an OSObject of type 'OSArray' with a +0 retain count}} arr->release(); // expected-warning{{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} // expected-note@-1{{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} return arr->getCount(); diff --git a/clang/test/Analysis/retain-release-arc.m b/clang/test/Analysis/retain-release-arc.m index 702f8a411671..31081e964abb 100644 --- a/clang/test/Analysis/retain-release-arc.m +++ b/clang/test/Analysis/retain-release-arc.m @@ -90,7 +90,7 @@ void _dispatch_object_validate(dispatch_object_t object); CFErrorRef error; CFDictionaryRef testDict = CFPropertyListCreateWithData(kCFAllocatorDefault, (__bridge CFDataRef)plistData, 0, 0, &error); #if HAS_ARC - // expected-note@-2 {{Call to function 'CFPropertyListCreateWithData' returns a Core Foundation object of type CFPropertyListRef with a +1 retain count}} + // expected-note@-2 {{Call to function 'CFPropertyListCreateWithData' returns a Core Foundation object of type 'CFPropertyListRef' with a +1 retain count}} #endif return (__bridge NSDictionary *)testDict; #if HAS_ARC diff --git a/clang/test/Analysis/retain-release-path-notes.m b/clang/test/Analysis/retain-release-path-notes.m index bd24b6aa805d..23171eda1cc3 100644 --- a/clang/test/Analysis/retain-release-path-notes.m +++ b/clang/test/Analysis/retain-release-path-notes.m @@ -49,7 +49,7 @@ void creationViaAlloc () { } void creationViaCFCreate () { - CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}} + CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count}} return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}} } @@ -68,7 +68,7 @@ void acquisitionViaProperty (Foo *foo) { } void acquisitionViaCFFunction () { - CFTypeRef leaked = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}} + CFTypeRef leaked = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count}} CFRetain(leaked); // expected-note{{Reference count incremented. The object now has a +1 retain count}} return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}} } @@ -99,19 +99,19 @@ void autoreleaseUnowned (Foo *foo) { } void makeCollectableIgnored() { - CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}} + CFTypeRef leaked = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count}} CFMakeCollectable(leaked); NSMakeCollectable(leaked); return; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'leaked' is not referenced later in this execution path and has a retain count of +1}} } CFTypeRef CFCopyRuleViolation () { - CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}} + CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count}} return object; // expected-warning{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}} expected-note{{Object with a +0 retain count returned to caller where a +1 (owning) retain count is expected}} } CFTypeRef CFGetRuleViolation () { - CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}} + CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count}} return object; // expected-warning{{leak}} expected-note{{Object leaked: object allocated and stored into 'object' is returned from a function whose name ('CFGetRuleViolation') does not contain 'Copy' or 'Create'. This violates the naming convention rules given in the Memory Management Guide for Core Foundation}} } @@ -227,7 +227,7 @@ static int Cond; // expected-note@-1 {{Method returns an instance of MyObj with a +1 retain count}} // expected-note@-2 {{Calling 'initX'}} // expected-note@-3 {{Returning from 'initX'}} - // expected-note@-4 {{Object leaked: allocated object of type MyObj * is not referenced later in this execution path and has a retain count of +1}} + // expected-note@-4 {{Object leaked: allocated object of type 'MyObj *' is not referenced later in this execution path and has a retain count of +1}} // initI is inlined because the allocation happens within initY id y = [[MyObj alloc] initY]; // expected-note@-1 {{Calling 'initY'}} @@ -244,20 +244,20 @@ static int Cond; void CFOverAutorelease() { - CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type CFTypeRef with a +1 retain count}} + CFTypeRef object = CFCreateSomething(); // expected-note{{Call to function 'CFCreateSomething' returns a Core Foundation object of type 'CFTypeRef' with a +1 retain count}} CFAutorelease(object); // expected-note{{Object autoreleased}} CFAutorelease(object); // expected-note{{Object autoreleased}} return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased 2 times but the object has a +1 retain count}} } void CFAutoreleaseUnowned() { - CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}} + CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count}} CFAutorelease(object); // expected-note{{Object autoreleased}} return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased but has a +0 retain count}} } void CFAutoreleaseUnownedMixed() { - CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type CFTypeRef with a +0 retain count}} + CFTypeRef object = CFGetSomething(); // expected-note{{Call to function 'CFGetSomething' returns a Core Foundation object of type 'CFTypeRef' with a +0 retain count}} CFAutorelease(object); // expected-note{{Object autoreleased}} [(id)object autorelease]; // expected-note{{Object autoreleased}} return; // expected-warning{{Object autoreleased too many times}} expected-note{{Object was autoreleased 2 times but the object has a +0 retain count}} diff --git a/clang/test/Analysis/retaincountchecker-compoundregion.m b/clang/test/Analysis/retaincountchecker-compoundregion.m index ce1f7a9aa18d..83857e268d98 100644 --- a/clang/test/Analysis/retaincountchecker-compoundregion.m +++ b/clang/test/Analysis/retaincountchecker-compoundregion.m @@ -19,7 +19,7 @@ void foo(CFAllocatorRef allocator) { int width = 0; int height = 0; CFTypeRef* values = (CFTypeRef[]){ - CFNumberCreate(allocator, kCFNumberSInt32Type, &width), //expected-warning{{Potential leak of an object of type CFNumberRef}} - CFNumberCreate(allocator, kCFNumberSInt32Type, &height), //expected-warning{{Potential leak of an object of type CFNumberRef}} + CFNumberCreate(allocator, kCFNumberSInt32Type, &width), //expected-warning{{Potential leak of an object of type 'CFNumberRef'}} + CFNumberCreate(allocator, kCFNumberSInt32Type, &height), //expected-warning{{Potential leak of an object of type 'CFNumberRef'}} }; }