Index: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp =================================================================== --- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -1062,6 +1062,7 @@ // Inspect the result type. QualType RetTy = FT->getReturnType(); + StringRef RetTyName = RetTy.getAsString(); // FIXME: This should all be refactored into a chain of "summary lookup" // filters. @@ -1081,12 +1082,14 @@ AllowAnnotations = false; } else if (FName == "CFPlugInInstanceCreate") { S = getPersistentSummary(RetEffect::MakeNoRet()); - } else if (FName == "IOBSDNameMatching" || + } else if (FName == "IORegistryEntrySearchCFProperty" + || (RetTyName == "CFMutableDictionaryRef" && ( + FName == "IOBSDNameMatching" || FName == "IOServiceMatching" || FName == "IOServiceNameMatching" || - FName == "IORegistryEntrySearchCFProperty" || FName == "IORegistryEntryIDMatching" || - FName == "IOOpenFirmwarePathMatching") { + FName == "IOOpenFirmwarePathMatching" + ))) { // Part of . (IOKit) // This should be addressed using a API table. S = getPersistentSummary(RetEffect::MakeOwned(RetEffect::CF), Index: cfe/trunk/test/Analysis/retain-release.mm =================================================================== --- cfe/trunk/test/Analysis/retain-release.mm +++ cfe/trunk/test/Analysis/retain-release.mm @@ -463,3 +463,10 @@ // rdar://34210609 void _() { _(); }; // no-warning + +// Do not assume that IOBSDNameMatching increments a reference counter, +// unless return type is CFMutableDictionaryRef. +void* IOBSDNameMatching(); +void rdar33832412() { + void* x = IOBSDNameMatching(); // no-warning +}