Remove rdar links; NFC

This removes links to rdar, which is an internal bug tracker that the
community doesn't have visibility into.

See further discussion at:
https://discourse.llvm.org/t/code-review-reminder-about-links-in-code-commit-messages/71847
This commit is contained in:
Aaron Ballman
2023-07-07 08:38:35 -04:00
parent d8dc1c22bf
commit d618f1c3b1
1244 changed files with 10134 additions and 12254 deletions

View File

@@ -2252,8 +2252,7 @@ CFGBlock *CFGBuilder::Visit(Stmt * S, AddStmtChoice asc,
// FIXME: The expression inside a CXXDefaultArgExpr is owned by the
// called function's declaration, not by the caller. If we simply add
// this expression to the CFG, we could end up with the same Expr
// appearing multiple times.
// PR13385 / <rdar://problem/12156507>
// appearing multiple times. PR13385
//
// It's likewise possible for multiple CXXDefaultInitExprs for the same
// expression to be used in the same function (through aggregate

View File

@@ -301,7 +301,6 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
std::string RetTyName = RetTy.getAsString();
if (FName == "pthread_create" || FName == "pthread_setspecific") {
// Part of: <rdar://problem/7299394> and <rdar://problem/11282706>.
// This will be addressed better with IPA.
return getPersistentStopSummary();
} else if(FName == "NSMakeCollectable") {
@@ -311,7 +310,6 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
: getPersistentStopSummary();
} else if (FName == "CMBufferQueueDequeueAndRetain" ||
FName == "CMBufferQueueDequeueIfDataReadyAndRetain") {
// Part of: <rdar://problem/39390714>.
return getPersistentSummary(RetEffect::MakeOwned(ObjKind::CF),
ScratchArgs,
ArgEffect(DoNothing),
@@ -324,13 +322,11 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
FName == "IOServiceNameMatching" ||
FName == "IORegistryEntryIDMatching" ||
FName == "IOOpenFirmwarePathMatching"))) {
// Part of <rdar://problem/6961230>. (IOKit)
// This should be addressed using a API table.
return getPersistentSummary(RetEffect::MakeOwned(ObjKind::CF), ScratchArgs,
ArgEffect(DoNothing), ArgEffect(DoNothing));
} else if (FName == "IOServiceGetMatchingService" ||
FName == "IOServiceGetMatchingServices") {
// FIXES: <rdar://problem/6326900>
// This should be addressed using a API table. This strcmp is also
// a little gross, but there is no need to super optimize here.
ScratchArgs = AF.add(ScratchArgs, 1, ArgEffect(DecRef, ObjKind::CF));
@@ -339,14 +335,12 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
ArgEffect(DoNothing), ArgEffect(DoNothing));
} else if (FName == "IOServiceAddNotification" ||
FName == "IOServiceAddMatchingNotification") {
// Part of <rdar://problem/6961230>. (IOKit)
// This should be addressed using a API table.
ScratchArgs = AF.add(ScratchArgs, 2, ArgEffect(DecRef, ObjKind::CF));
return getPersistentSummary(RetEffect::MakeNoRet(),
ScratchArgs,
ArgEffect(DoNothing), ArgEffect(DoNothing));
} else if (FName == "CVPixelBufferCreateWithBytes") {
// FIXES: <rdar://problem/7283567>
// Eventually this can be improved by recognizing that the pixel
// buffer passed to CVPixelBufferCreateWithBytes is released via
// a callback and doing full IPA to make sure this is done correctly.
@@ -357,7 +351,6 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
ScratchArgs,
ArgEffect(DoNothing), ArgEffect(DoNothing));
} else if (FName == "CGBitmapContextCreateWithData") {
// FIXES: <rdar://problem/7358899>
// Eventually this can be improved by recognizing that 'releaseInfo'
// passed to CGBitmapContextCreateWithData is released via
// a callback and doing full IPA to make sure this is done correctly.
@@ -365,7 +358,6 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
return getPersistentSummary(RetEffect::MakeOwned(ObjKind::CF), ScratchArgs,
ArgEffect(DoNothing), ArgEffect(DoNothing));
} else if (FName == "CVPixelBufferCreateWithPlanarBytes") {
// FIXES: <rdar://problem/7283567>
// Eventually this can be improved by recognizing that the pixel
// buffer passed to CVPixelBufferCreateWithPlanarBytes is released
// via a callback and doing full IPA to make sure this is done
@@ -386,10 +378,9 @@ const RetainSummary *RetainSummaryManager::getSummaryForObjCOrCFObject(
ArgEffect(DoNothing), ArgEffect(DoNothing));
} else if (FName == "dispatch_set_context" ||
FName == "xpc_connection_set_context") {
// <rdar://problem/11059275> - The analyzer currently doesn't have
// a good way to reason about the finalizer function for libdispatch.
// If we pass a context object that is memory managed, stop tracking it.
// <rdar://problem/13783514> - Same problem, but for XPC.
// The analyzer currently doesn't have a good way to reason about the
// finalizer function for libdispatch. If we pass a context object that is
// memory managed, stop tracking it.
// FIXME: this hack should possibly go away once we can handle
// libdispatch and XPC finalizers.
ScratchArgs = AF.add(ScratchArgs, 1, ArgEffect(StopTracking));
@@ -740,7 +731,6 @@ RetainSummaryManager::canEval(const CallExpr *CE, const FunctionDecl *FD,
// It's okay to be a little sloppy here.
if (FName == "CMBufferQueueDequeueAndRetain" ||
FName == "CMBufferQueueDequeueIfDataReadyAndRetain") {
// Part of: <rdar://problem/39390714>.
// These are not retain. They just return something and retain it.
return std::nullopt;
}
@@ -1243,7 +1233,6 @@ void RetainSummaryManager::InitializeMethodSummaries() {
// FIXME: For now we opt for false negatives with NSWindow, as these objects
// self-own themselves. However, they only do this once they are displayed.
// Thus, we need to track an NSWindow's display status.
// This is tracked in <rdar://problem/6062711>.
// See also http://llvm.org/bugs/show_bug.cgi?id=3714.
const RetainSummary *NoTrackYet =
getPersistentSummary(RetEffect::MakeNoRet(), ScratchArgs,
@@ -1259,7 +1248,6 @@ void RetainSummaryManager::InitializeMethodSummaries() {
// For NSNull, objects returned by +null are singletons that ignore
// retain/release semantics. Just don't track them.
// <rdar://problem/12858915>
addClassMethSummary("NSNull", "null", NoTrackYet);
// Don't track allocated autorelease pools, as it is okay to prematurely

View File

@@ -3329,7 +3329,7 @@ CGObjCCommonMac::EmitProtocolMethodTypes(Twine Name,
struct _objc_method_list *instance_methods;
struct _objc_method_list *class_methods;
struct _objc_protocol_list *protocols;
uint32_t size; // <rdar://4585769>
uint32_t size;
struct _objc_property_list *instance_properties;
struct _objc_property_list *class_properties;
};
@@ -4492,8 +4492,7 @@ llvm::FunctionType *FragileHazards::GetAsmFnType() {
indeterminate value. For the purposes of LLVM IR, it may be
sufficient to make loads and stores within the @try (to variables
declared outside the @try) volatile. This is necessary for
optimized correctness, but is not currently being done; this is
being tracked as rdar://problem/8160285
optimized correctness, but is not currently being done.
The basic framework for a @try-catch-finally is as follows:
{
@@ -5092,7 +5091,7 @@ enum ImageInfoFlags {
eImageInfo_OptimizedByDyld = (1 << 3), // This flag is set by the dyld shared cache.
// A flag indicating that the module has no instances of a @synthesize of a
// superclass variable. <rdar://problem/6803242>
// superclass variable.
eImageInfo_CorrectedSynthesize = (1 << 4), // This flag is no longer set by clang.
eImageInfo_ImageIsSimulated = (1 << 5),
eImageInfo_ClassProperties = (1 << 6)

View File

@@ -5989,7 +5989,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
}
// Note: -fwritable-strings doesn't make the backing store strings of
// CFStrings writable. (See <rdar://problem/10657500>)
// CFStrings writable.
auto *GV =
new llvm::GlobalVariable(getModule(), C->getType(), /*isConstant=*/true,
llvm::GlobalValue::PrivateLinkage, C, ".str");

View File

@@ -5531,8 +5531,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
// Enable -mconstructor-aliases except on darwin, where we have to work around
// a linker bug (see <rdar://problem/7651567>), and CUDA device code, where
// aliases aren't supported.
// a linker bug, and CUDA device code, where aliases aren't supported.
if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
CmdArgs.push_back("-mconstructor-aliases");

View File

@@ -2795,9 +2795,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
}
// FIXME: Implement warning dependent on NSCopying being
// implemented. See also:
// <rdar://5168496&4855821&5607453&5096644&4947311&5698469&4947014&5168496>
// (please trim this list while you are at it).
// implemented. (Please trim this list while you are at it.)
}
if (!(Attributes & ObjCPropertyAttribute::kind_copy) &&

View File

@@ -219,7 +219,6 @@ void WalkAST::VisitForStmt(ForStmt *FS) {
//===----------------------------------------------------------------------===//
// Check: floating point variable used as loop counter.
// Originally: <rdar://problem/6336718>
// Implements: CERT security coding advisory FLP-30.
//===----------------------------------------------------------------------===//
@@ -468,7 +467,6 @@ void WalkAST::checkCall_bzero(const CallExpr *CE, const FunctionDecl *FD) {
//===----------------------------------------------------------------------===//
// Check: Any use of 'gets' is insecure.
// Originally: <rdar://problem/6335715>
// Implements (part of): 300-BSI (buildsecurityin.us-cert.gov)
// CWE-242: Use of Inherently Dangerous Function
//===----------------------------------------------------------------------===//
@@ -848,7 +846,6 @@ bool WalkAST::checkCall_strCommon(const CallExpr *CE, const FunctionDecl *FD) {
//===----------------------------------------------------------------------===//
// Check: Linear congruent random number generators should not be used
// Originally: <rdar://problem/63371000>
// CWE-338: Use of cryptographically weak prng
//===----------------------------------------------------------------------===//
@@ -892,7 +889,6 @@ void WalkAST::checkCall_rand(const CallExpr *CE, const FunctionDecl *FD) {
//===----------------------------------------------------------------------===//
// Check: 'random' should not be used
// Originally: <rdar://problem/63371000>
//===----------------------------------------------------------------------===//
void WalkAST::checkCall_random(const CallExpr *CE, const FunctionDecl *FD) {
@@ -991,7 +987,6 @@ void WalkAST::checkMsg_decodeValueOfObjCType(const ObjCMessageExpr *ME) {
//===----------------------------------------------------------------------===//
// Check: Should check whether privileges are dropped successfully.
// Originally: <rdar://problem/6337132>
//===----------------------------------------------------------------------===//
void WalkAST::checkUncheckedReturnValue(CallExpr *CE) {

View File

@@ -786,9 +786,8 @@ RefLeakReportVisitor::getEndPath(BugReporterContext &BRC,
assert(RV);
if (RV->getKind() == RefVal::ErrorLeakReturned) {
// FIXME: Per comments in rdar://6320065, "create" only applies to CF
// objects. Only "copy", "alloc", "retain" and "new" transfer ownership
// to the caller for NS objects.
// FIXME: "create" only applies to CF objects. Only "copy", "alloc",
// "retain" and "new" transfer ownership to the caller for NS objects.
const Decl *D = &EndN->getCodeDecl();
os << (isa<ObjCMethodDecl>(D) ? " is returned from a method "

View File

@@ -765,7 +765,7 @@ RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const {
// the static type. However, because we currently don't update
// DynamicTypeInfo when an object is cast, we can't actually be sure the
// DynamicTypeInfo is up to date. This assert should be re-enabled once
// this is fixed. <rdar://problem/12287087>
// this is fixed.
//assert(!MD->getParent()->isDerivedFrom(RD) && "Bad DynamicTypeInfo");
return {};

View File

@@ -178,7 +178,7 @@ void ExprEngine::VisitObjCMessage(const ObjCMessageExpr *ME,
// We could avoid dropping coverage by performing an explicit case split
// on each method call -- but this would get very expensive. An alternative
// would be to introduce lazy constraints.
// FIXME: This ignores many potential bugs (<rdar://problem/11733396>).
// FIXME: This ignores many potential bugs.
// Revisit once we have lazier constraints.
if (Msg->isInstanceMessage()) {
SVal recVal = Msg->getReceiverSVal();

View File

@@ -1,7 +1,6 @@
// RUN: %clang_cc1 -arcmt-action=check -no-ns-alloc-error -triple x86_64-apple-darwin10 -fobjc-gc-only %s 2>&1 | grep 'warning: \[rewriter\] call returns pointer to GC managed memory'
// RUN: %clang_cc1 -arcmt-action=check -no-ns-alloc-error -triple x86_64-apple-darwin10 -fobjc-gc-only -x objective-c++ %s 2>&1 | grep 'warning: \[rewriter\] call returns pointer to GC managed memory'
// TODO: Investigate VerifyDiagnosticConsumer failures on these tests when using -verify.
// rdar://10532541
typedef unsigned NSUInteger;
void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options);

View File

@@ -77,7 +77,6 @@ __attribute__((objc_arc_weak_reference_unavailable))
}
@end
// rdar://10532449
@interface rdar10532449
@property (assign) id assign_prop;
@property (assign, readonly) id __strong strong_readonly_prop;

View File

@@ -85,7 +85,6 @@ __attribute__((objc_arc_weak_reference_unavailable))
}
@end
// rdar://10532449
@interface rdar10532449
@property (strong) id assign_prop;
@property (strong, readonly) id strong_readonly_prop;

View File

@@ -77,7 +77,6 @@ __attribute__((objc_arc_weak_reference_unavailable))
}
@end
// rdar://10532449
@interface rdar10532449
@property (assign) id assign_prop;
@property (assign, readonly) id __strong strong_readonly_prop;

View File

@@ -72,7 +72,6 @@ __attribute__((objc_arc_weak_reference_unavailable))
}
@end
// rdar://10532449
@interface rdar10532449
@property (strong) id assign_prop;
@property (strong, readonly) id strong_readonly_prop;

View File

@@ -2,7 +2,6 @@
// RUN: %clang_cc1 -include-pch %t.pch -arcmt-action=check -verify -triple x86_64-apple-darwin10 -fblocks -Werror %s
// REQUIRES: x86-registered-target
// rdar://9601437
@interface I9601437 {
__unsafe_unretained id x;
}

View File

@@ -288,7 +288,6 @@ id test9(Test9 *v) {
return [v init1];
}
// rdar://9491791
void rdar9491791(int p) {
switch (p) {
case 3:;
@@ -302,12 +301,10 @@ void rdar9491791(int p) {
#define RELEASE_MACRO(x) do { [x release]; } while(1)
// rdar://9504750
void rdar9504750(id p) {
RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}}
}
// rdar://8939557
@interface TestReadonlyProperty : NSObject
@property(assign,readonly) NSObject *value;
@end
@@ -319,7 +316,6 @@ void rdar9504750(id p) {
}
@end
// rdar://9601437
@interface I9601437 {
__unsafe_unretained id x;
}

View File

@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -arcmt-action=check -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -verify %s
// rdar://10387088
typedef const void * CFTypeRef;
CFTypeRef CFBridgingRetain(id X);
id CFBridgingRelease(CFTypeRef);

View File

@@ -56,7 +56,6 @@ CFStringRef f3(void) {
extern void NSLog(NSString *format, ...);
// rdar://13192395
void f4(NSString *s) {
NSLog(@"%@", (CFStringRef)s); // expected-error {{cast of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast}} \
// expected-note{{use __bridge to convert directly (no change in ownership)}} \

View File

@@ -608,7 +608,6 @@ void f17(int x, CFTypeRef p) {
}
@end
// <rdar://problem/6659160>
int isFoo(char c);
static void rdar_6659160(char *inkind, char *inname)
@@ -682,10 +681,10 @@ void pr3820_DeallocAfterRelease(void)
// message sent to released object
}
// From <rdar://problem/6704930>. The problem here is that 'length' binds to
// '($0 - 1)' after '--length', but SimpleConstraintManager doesn't know how to
// reason about '($0 - 1) > constant'. As a temporary hack, we drop the value
// of '($0 - 1)' and conjure a new symbol.
// The problem here is that 'length' binds to '($0 - 1)' after '--length', but
// SimpleConstraintManager doesn't know how to reason about
// '($0 - 1) > constant'. As a temporary hack, we drop the value of '($0 - 1)'
// and conjure a new symbol.
void rdar6704930(unsigned char *s, unsigned int length) {
NSString* name = 0;
if (s != 0) {
@@ -716,7 +715,6 @@ void rdar6704930(unsigned char *s, unsigned int length) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6833332>
// One build of the analyzer accidentally stopped tracking the allocated
// object after the 'retain'.
//===----------------------------------------------------------------------===//
@@ -749,9 +747,8 @@ void rdar6704930(unsigned char *s, unsigned int length) {
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6257780> clang checker fails to catch use-after-release
// clang checker fails to catch use-after-release
//===----------------------------------------------------------------------===//
int rdar_6257780_Case1(void) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSArray *array = [NSArray array];
@@ -761,18 +758,16 @@ int rdar_6257780_Case1(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/10640253> Analyzer is confused about NSAutoreleasePool -allocWithZone:.
// Analyzer is confused about NSAutoreleasePool -allocWithZone:.
//===----------------------------------------------------------------------===//
void rdar_10640253_autorelease_allocWithZone(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool allocWithZone:(NSZone*)0] init];
(void) pool;
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6866843> Checker should understand new/setObject:/release constructs
// Checker should understand new/setObject:/release constructs
//===----------------------------------------------------------------------===//
void rdar_6866843(void) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
@@ -788,9 +783,8 @@ void rdar_6866843(void) {
//===----------------------------------------------------------------------===//
// <rdar://problem/6877235> Classes typedef-ed to CF objects should get the same treatment as CF objects
// Classes typedef-ed to CF objects should get the same treatment as CF objects
//===----------------------------------------------------------------------===//
typedef CFTypeRef OtherRef;
@interface RDar6877235 : NSObject {}
@@ -808,10 +802,8 @@ typedef CFTypeRef OtherRef;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6320065> false positive - init method returns an object
// owned by caller
// false positive - init method returns an object owned by caller
//===----------------------------------------------------------------------===//
@interface RDar6320065 : NSObject {
NSString *_foo;
}
@@ -852,10 +844,8 @@ int RDar6320065_test(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7129086> -awakeAfterUsingCoder: returns an owned object
// and claims the receiver
// -awakeAfterUsingCoder: returns an owned object and claims the receiver
//===----------------------------------------------------------------------===//
@interface RDar7129086 : NSObject {} @end
@implementation RDar7129086
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder {
@@ -865,10 +855,8 @@ int RDar6320065_test(void) {
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a
// retained object
// [NSData dataWithBytesNoCopy] does not return a retained object
//===----------------------------------------------------------------------===//
@interface RDar6859457 : NSObject {}
- (NSString*) NoCopyString;
- (NSString*) noCopyString;
@@ -909,7 +897,6 @@ static void PR4230_new(void)
// Method name that has a null IdentifierInfo* for its first selector slot.
// This test just makes sure that we handle it.
//===----------------------------------------------------------------------===//
@interface TestNullIdentifier
@end
@@ -920,8 +907,7 @@ static void PR4230_new(void)
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6893565> don't flag leaks for return types that cannot be
// determined to be CF types
// don't flag leaks for return types that cannot be determined to be CF types
//===----------------------------------------------------------------------===//
// We don't know if 'struct s6893565' represents a Core Foundation type, so
@@ -939,9 +925,8 @@ typedef struct s6893565* TD6893565;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6902710> clang: false positives w/QC and CoreImage methods
// clang: false positives w/QC and CoreImage methods
//===----------------------------------------------------------------------===//
void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context,
NSString *str, CIImage *img, CGRect rect,
CIFormat form, CGColorSpaceRef cs) {
@@ -952,19 +937,15 @@ void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:]
// misinterpreted by clang scan-build
// -[CIContext createCGLayerWithSize:info:] misinterpreted by clang scan-build
//===----------------------------------------------------------------------===//
void rdar6945561(CIContext *context, CGSize size, CFDictionaryRef d) {
[context createCGLayerWithSize:size info:d]; // expected-warning{{leak}}
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6961230> add knowledge of IOKit functions to retain/release
// checker
// Add knowledge of IOKit functions to retain/release checker.
//===----------------------------------------------------------------------===//
void IOBSDNameMatching_wrapper(mach_port_t mainPort, uint32_t options, const char * bsdName) {
IOBSDNameMatching(mainPort, options, bsdName); // expected-warning{{leak}}
}
@@ -1020,10 +1001,8 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort,
//===----------------------------------------------------------------------===//
// Test of handling objects whose references "escape" to containers.
//===----------------------------------------------------------------------===//
void CFDictionaryAddValue(CFMutableDictionaryRef, void *, void *);
// <rdar://problem/6539791>
void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
CFMutableDictionaryRef x = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(y, key, x);
@@ -1037,7 +1016,6 @@ void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
}
}
// <rdar://problem/6560661>
// Same issue, except with "AppendValue" functions.
void rdar_6560661(CFMutableArrayRef x) {
signed z = 1;
@@ -1049,7 +1027,6 @@ void rdar_6560661(CFMutableArrayRef x) {
CFRelease(value); // no-warning
}
// <rdar://problem/7152619>
// Same issue, excwept with "CFAttributeStringSetAttribute".
void rdar_7152619(CFStringRef str) {
CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault, str, 0);
@@ -1109,14 +1086,13 @@ void rdar_7184450_pos(CGContextRef myContext, CGFloat x, CGPoint myStartPoint,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7299394> clang false positive: retained instance passed to
// thread in pthread_create marked as leak
// clang false positive: retained instance passed to thread in pthread_create
// marked as leak
//
// Until we have full IPA, the analyzer should stop tracking the reference
// count of objects passed to pthread_create.
//
//===----------------------------------------------------------------------===//
struct _opaque_pthread_t {};
struct _opaque_pthread_attr_t {};
typedef struct _opaque_pthread_t *__darwin_pthread_t;
@@ -1144,18 +1120,15 @@ void rdar_7299394_positive(pthread_attr_t *attr, pthread_t *thread) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/11282706> false positive with not understanding thread
// local storage
// false positive with not understanding thread local storage
//===----------------------------------------------------------------------===//
void rdar11282706(pthread_key_t key) {
NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning
pthread_setspecific(key, (void*) number);
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7283567> False leak associated with call to
// CVPixelBufferCreateWithBytes ()
// False leak associated with call to CVPixelBufferCreateWithBytes ()
//
// According to the Core Video Reference (ADC), CVPixelBufferCreateWithBytes and
// CVPixelBufferCreateWithPlanarBytes can release (via a callback) the
@@ -1163,7 +1136,6 @@ void rdar11282706(pthread_key_t key) {
// the reference count for the objects passed for this argument. This
// could be made smarter.
//===----------------------------------------------------------------------===//
typedef int int32_t;
typedef UInt32 FourCharCode;
typedef FourCharCode OSType;
@@ -1254,8 +1226,7 @@ CVReturn rdar_7283567_2(CFAllocatorRef allocator, size_t width, size_t height,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7358899> False leak associated with
// CGBitmapContextCreateWithData
// False leak associated with CGBitmapContextCreateWithData
//===----------------------------------------------------------------------===//
typedef uint32_t CGBitmapInfo;
typedef void (*CGBitmapContextReleaseDataCallback)(void *releaseInfo, void *data);
@@ -1280,14 +1251,13 @@ void rdar_7358899(void *data,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7265711> allow 'new', 'copy', 'alloc', 'init' prefix to
// start before '_' when determining Cocoa fundamental rule
// Allow 'new', 'copy', 'alloc', 'init' prefix to start before '_' when
// determining Cocoa fundamental rule.
//
// Previously the retain/release checker just skipped prefixes before the
// first '_' entirely. Now the checker honors the prefix if it results in a
// recognizable naming convention (e.g., 'new', 'init').
//===----------------------------------------------------------------------===//
@interface RDar7265711 {}
- (id) new_stuff;
@end
@@ -1302,10 +1272,8 @@ void rdar7265711_b(RDar7265711 *x) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7306898> clang thinks [NSCursor dragCopyCursor] returns a
// retained reference
// clang thinks [NSCursor dragCopyCursor] returns a retained reference
//===----------------------------------------------------------------------===//
@interface NSCursor : NSObject
+ (NSCursor *)dragCopyCursor;
@end
@@ -1318,10 +1286,9 @@ void rdar7306898(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7252064> sending 'release', 'retain', etc. to a Class
// directly is not likely what the user intended
// Sending 'release', 'retain', etc. to a Class directly is not likely what the
// user intended.
//===----------------------------------------------------------------------===//
@interface RDar7252064 : NSObject @end
void rdar7252064(void) {
[RDar7252064 release]; // expected-warning{{The 'release' message should be sent to instances of class 'RDar7252064' and not the class directly}}
@@ -1462,10 +1429,9 @@ CFDateRef returnsRetainedCFDate(void) {
//===----------------------------------------------------------------------===//
// Test that leaks post-dominated by "panic" functions are not reported.
//
// <rdar://problem/5905851> do not report a leak when post-dominated by a call
// to a noreturn or panic function
// Do not report a leak when post-dominated by a call to a noreturn or panic
// function.
//===----------------------------------------------------------------------===//
void panic(void) __attribute__((noreturn));
void panic_not_in_hardcoded_list(void) __attribute__((noreturn));
@@ -1493,9 +1459,9 @@ void test_panic_pos_2(int x) {
if (x)
panic();
if (!x) {
// This showed up in <rdar://problem/7796563>, where we silently missed checking
// the function type for noreturn. "panic()" is a hard-coded known panic function
// that isn't always noreturn.
// This showed up previously where we silently missed checking the function
// type for noreturn. "panic()" is a hard-coded known panic function that
// isn't always noreturn.
panic_not_in_hardcoded_list();
}
}
@@ -1542,17 +1508,14 @@ void test_blocks_1_indirect_retain_via_call(void) {
}
@end
// <rdar://problem/8272168> - Correcly handle Class<...> in Cocoa Conventions
// detector.
// Correcly handle Class<...> in Cocoa Conventions detector.
@protocol Prot_R8272168 @end
Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(void);
void r8272168(void) {
GetAClassThatImplementsProt_R8272168();
}
// Test case for <rdar://problem/8356342>, which in the past triggered
// a false positive.
// Test case which in the past triggered a false positive.
@interface RDar8356342
- (NSDate*) rdar8356342:(NSDate *)inValue;
@end
@@ -1570,8 +1533,7 @@ void r8272168(void) {
}
@end
// <rdar://problem/8724287> - This test case previously crashed because
// of a bug in BugReporter.
// This test case previously crashed because of a bug in BugReporter.
extern const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key);
typedef struct __CFError * CFErrorRef;
extern const CFStringRef kCFErrorUnderlyingErrorKey;
@@ -1593,16 +1555,15 @@ static void rdar_8724287(CFErrorRef error)
}
}
// <rdar://problem/9234108> - Make sure the model applies cf_consumed
// correctly in argument positions besides the first.
// Make sure the model applies cf_consumed correctly in argument positions
// besides the first.
extern void *CFStringCreate(void);
extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value);
void rdar_9234108(void) {
rdar_9234108_helper(0, CFStringCreate());
}
// <rdar://problem/9726279> - Make sure that objc_method_family works
// to override naming conventions.
// Make sure that objc_method_family works to override naming conventions.
struct TwoDoubles {
double one;
double two;
@@ -1626,7 +1587,6 @@ void rdar9726279(void) {
[value release];
}
// <rdar://problem/9732321>
// Test camelcase support for CF conventions. While Core Foundation APIs
// don't use camel casing, other code is allowed to use it.
CFArrayRef camelcase_create_1(void) {
@@ -1678,7 +1638,6 @@ CFArrayRef camel_copymachine(void) {
return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}}
}
// rdar://problem/8024350
@protocol F18P
- (id) clone;
@end
@@ -1693,7 +1652,6 @@ CFArrayRef camel_copymachine(void) {
}
@end
// Radar 6582778.
void rdar6582778(void) {
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
CFTypeRef vals[] = { CFDateCreate(0, t) }; // expected-warning {{leak}}
@@ -1706,9 +1664,7 @@ void rdar6582778_2(void) {
global = CFDateCreate(0, t); // no-warning
}
// <rdar://problem/10232019> - Test that objects passed to containers
// are marked "escaped".
// Test that objects passed to containers are marked "escaped".
void rdar10232019(void) {
NSMutableArray *array = [NSMutableArray array];
@@ -1731,7 +1687,6 @@ void rdar10232019_positive(void) {
}
// RetainCountChecker support for XPC.
// <rdar://problem/9658496>
typedef void * xpc_object_t;
xpc_object_t _CFXPCCreateXPCObjectFromCFObject(CFTypeRef cf);
void xpc_release(xpc_object_t object);
@@ -2037,9 +1992,8 @@ static int Cond;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/13783514> xpc_connection_set_finalizer_f
// xpc_connection_set_finalizer_f
//===----------------------------------------------------------------------===//
typedef xpc_object_t xpc_connection_t;
typedef void (*xpc_finalizer_t)(void *value);
void xpc_connection_set_context(xpc_connection_t connection, void *ctx);

View File

@@ -650,7 +650,6 @@ void f17(int x, CFTypeRef p) {
}
@end
// <rdar://problem/6659160>
int isFoo(char c);
static void rdar_6659160(char *inkind, char *inname)
@@ -724,10 +723,10 @@ void pr3820_DeallocAfterRelease(void)
// message sent to released object
}
// From <rdar://problem/6704930>. The problem here is that 'length' binds to
// '($0 - 1)' after '--length', but SimpleConstraintManager doesn't know how to
// reason about '($0 - 1) > constant'. As a temporary hack, we drop the value
// of '($0 - 1)' and conjure a new symbol.
// The problem here is that 'length' binds to '($0 - 1)' after '--length', but
// SimpleConstraintManager doesn't know how to reason about
// '($0 - 1) > constant'. As a temporary hack, we drop the value of '($0 - 1)'
// and conjure a new symbol.
void rdar6704930(unsigned char *s, unsigned int length) {
NSString* name = 0;
if (s != 0) {
@@ -758,7 +757,6 @@ void rdar6704930(unsigned char *s, unsigned int length) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6833332>
// One build of the analyzer accidentally stopped tracking the allocated
// object after the 'retain'.
//===----------------------------------------------------------------------===//
@@ -791,9 +789,8 @@ void rdar6704930(unsigned char *s, unsigned int length) {
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6257780> clang checker fails to catch use-after-release
// clang checker fails to catch use-after-release
//===----------------------------------------------------------------------===//
int rdar_6257780_Case1(void) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSArray *array = [NSArray array];
@@ -803,18 +800,16 @@ int rdar_6257780_Case1(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/10640253> Analyzer is confused about NSAutoreleasePool -allocWithZone:.
// Analyzer is confused about NSAutoreleasePool -allocWithZone:.
//===----------------------------------------------------------------------===//
void rdar_10640253_autorelease_allocWithZone(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool allocWithZone:(NSZone*)0] init];
(void) pool;
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6866843> Checker should understand new/setObject:/release constructs
// Checker should understand new/setObject:/release constructs
//===----------------------------------------------------------------------===//
void rdar_6866843(void) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
@@ -830,9 +825,8 @@ void rdar_6866843(void) {
//===----------------------------------------------------------------------===//
// <rdar://problem/6877235> Classes typedef-ed to CF objects should get the same treatment as CF objects
// Classes typedef-ed to CF objects should get the same treatment as CF objects
//===----------------------------------------------------------------------===//
typedef CFTypeRef OtherRef;
@interface RDar6877235 : NSObject {}
@@ -850,10 +844,8 @@ typedef CFTypeRef OtherRef;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6320065> false positive - init method returns an object
// owned by caller
// false positive - init method returns an object owned by caller
//===----------------------------------------------------------------------===//
@interface RDar6320065 : NSObject {
NSString *_foo;
}
@@ -894,10 +886,8 @@ int RDar6320065_test(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7129086> -awakeAfterUsingCoder: returns an owned object
// and claims the receiver
// -awakeAfterUsingCoder: returns an owned object and claims the receiver
//===----------------------------------------------------------------------===//
@interface RDar7129086 : NSObject {} @end
@implementation RDar7129086
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder {
@@ -907,10 +897,8 @@ int RDar6320065_test(void) {
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a
// retained object
// [NSData dataWithBytesNoCopy] does not return a retained object
//===----------------------------------------------------------------------===//
@interface RDar6859457 : NSObject {}
- (NSString*) NoCopyString;
- (NSString*) noCopyString;
@@ -951,7 +939,6 @@ static void PR4230_new(void)
// Method name that has a null IdentifierInfo* for its first selector slot.
// This test just makes sure that we handle it.
//===----------------------------------------------------------------------===//
@interface TestNullIdentifier
@end
@@ -962,8 +949,7 @@ static void PR4230_new(void)
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6893565> don't flag leaks for return types that cannot be
// determined to be CF types
// don't flag leaks for return types that cannot be determined to be CF types
//===----------------------------------------------------------------------===//
// We don't know if 'struct s6893565' represents a Core Foundation type, so
@@ -981,9 +967,8 @@ typedef struct s6893565* TD6893565;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6902710> clang: false positives w/QC and CoreImage methods
// clang: false positives w/QC and CoreImage methods
//===----------------------------------------------------------------------===//
void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context,
NSString *str, CIImage *img, CGRect rect,
CIFormat form, CGColorSpaceRef cs) {
@@ -994,19 +979,15 @@ void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:]
// misinterpreted by clang scan-build
// -[CIContext createCGLayerWithSize:info:] misinterpreted by clang scan-build
//===----------------------------------------------------------------------===//
void rdar6945561(CIContext *context, CGSize size, CFDictionaryRef d) {
[context createCGLayerWithSize:size info:d]; // expected-warning{{leak}}
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6961230> add knowledge of IOKit functions to retain/release
// checker
// Add knowledge of IOKit functions to retain/release checker.
//===----------------------------------------------------------------------===//
void IOBSDNameMatching_wrapper(mach_port_t mainPort, uint32_t options, const char * bsdName) {
IOBSDNameMatching(mainPort, options, bsdName); // expected-warning{{leak}}
}
@@ -1062,10 +1043,8 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort,
//===----------------------------------------------------------------------===//
// Test of handling objects whose references "escape" to containers.
//===----------------------------------------------------------------------===//
void CFDictionaryAddValue(CFMutableDictionaryRef, void *, void *);
// <rdar://problem/6539791>
void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
CFMutableDictionaryRef x = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(y, key, x);
@@ -1079,7 +1058,6 @@ void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
}
}
// <rdar://problem/6560661>
// Same issue, except with "AppendValue" functions.
void rdar_6560661(CFMutableArrayRef x) {
signed z = 1;
@@ -1091,7 +1069,6 @@ void rdar_6560661(CFMutableArrayRef x) {
CFRelease(value); // no-warning
}
// <rdar://problem/7152619>
// Same issue, excwept with "CFAttributeStringSetAttribute".
void rdar_7152619(CFStringRef str) {
CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault, str, 0);
@@ -1151,14 +1128,13 @@ void rdar_7184450_pos(CGContextRef myContext, CGFloat x, CGPoint myStartPoint,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7299394> clang false positive: retained instance passed to
// thread in pthread_create marked as leak
// clang false positive: retained instance passed to thread in pthread_create
// marked as leak
//
// Until we have full IPA, the analyzer should stop tracking the reference
// count of objects passed to pthread_create.
//
//===----------------------------------------------------------------------===//
struct _opaque_pthread_t {};
struct _opaque_pthread_attr_t {};
typedef struct _opaque_pthread_t *__darwin_pthread_t;
@@ -1186,18 +1162,15 @@ void rdar_7299394_positive(pthread_attr_t *attr, pthread_t *thread) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/11282706> false positive with not understanding thread
// local storage
// false positive with not understanding thread local storage
//===----------------------------------------------------------------------===//
void rdar11282706(pthread_key_t key) {
NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning
pthread_setspecific(key, (void*) number);
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7283567> False leak associated with call to
// CVPixelBufferCreateWithBytes ()
// False leak associated with call to CVPixelBufferCreateWithBytes ()
//
// According to the Core Video Reference (ADC), CVPixelBufferCreateWithBytes and
// CVPixelBufferCreateWithPlanarBytes can release (via a callback) the
@@ -1205,7 +1178,6 @@ void rdar11282706(pthread_key_t key) {
// the reference count for the objects passed for this argument. This
// could be made smarter.
//===----------------------------------------------------------------------===//
typedef int int32_t;
typedef UInt32 FourCharCode;
typedef FourCharCode OSType;
@@ -1296,8 +1268,7 @@ CVReturn rdar_7283567_2(CFAllocatorRef allocator, size_t width, size_t height,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7358899> False leak associated with
// CGBitmapContextCreateWithData
// False leak associated with CGBitmapContextCreateWithData
//===----------------------------------------------------------------------===//
typedef uint32_t CGBitmapInfo;
typedef void (*CGBitmapContextReleaseDataCallback)(void *releaseInfo, void *data);
@@ -1322,14 +1293,13 @@ void rdar_7358899(void *data,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7265711> allow 'new', 'copy', 'alloc', 'init' prefix to
// start before '_' when determining Cocoa fundamental rule
// Allow 'new', 'copy', 'alloc', 'init' prefix to start before '_' when
// determining Cocoa fundamental rule.
//
// Previously the retain/release checker just skipped prefixes before the
// first '_' entirely. Now the checker honors the prefix if it results in a
// recognizable naming convention (e.g., 'new', 'init').
//===----------------------------------------------------------------------===//
@interface RDar7265711 {}
- (id) new_stuff;
@end
@@ -1344,10 +1314,8 @@ void rdar7265711_b(RDar7265711 *x) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7306898> clang thinks [NSCursor dragCopyCursor] returns a
// retained reference
// clang thinks [NSCursor dragCopyCursor] returns a retained reference
//===----------------------------------------------------------------------===//
@interface NSCursor : NSObject
+ (NSCursor *)dragCopyCursor;
@end
@@ -1360,10 +1328,9 @@ void rdar7306898(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7252064> sending 'release', 'retain', etc. to a Class
// directly is not likely what the user intended
// Sending 'release', 'retain', etc. to a Class directly is not likely what the
// user intended.
//===----------------------------------------------------------------------===//
@interface RDar7252064 : NSObject @end
void rdar7252064(void) {
[RDar7252064 release]; // expected-warning{{The 'release' message should be sent to instances of class 'RDar7252064' and not the class directly}}
@@ -1504,10 +1471,9 @@ CFDateRef returnsRetainedCFDate(void) {
//===----------------------------------------------------------------------===//
// Test that leaks post-dominated by "panic" functions are not reported.
//
// <rdar://problem/5905851> do not report a leak when post-dominated by a call
// to a noreturn or panic function
// Do not report a leak when post-dominated by a call to a noreturn or panic
// function.
//===----------------------------------------------------------------------===//
void panic(void) __attribute__((noreturn));
void panic_not_in_hardcoded_list(void) __attribute__((noreturn));
@@ -1535,9 +1501,9 @@ void test_panic_pos_2(int x) {
if (x)
panic();
if (!x) {
// This showed up in <rdar://problem/7796563>, where we silently missed checking
// the function type for noreturn. "panic()" is a hard-coded known panic function
// that isn't always noreturn.
// This showed up previously where we silently missed checking the function
// type for noreturn. "panic()" is a hard-coded known panic function that
// isn't always noreturn.
panic_not_in_hardcoded_list();
}
}
@@ -1584,17 +1550,14 @@ void test_blocks_1_indirect_retain_via_call(void) {
}
@end
// <rdar://problem/8272168> - Correcly handle Class<...> in Cocoa Conventions
// detector.
// Correcly handle Class<...> in Cocoa Conventions detector.
@protocol Prot_R8272168 @end
Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(void);
void r8272168(void) {
GetAClassThatImplementsProt_R8272168();
}
// Test case for <rdar://problem/8356342>, which in the past triggered
// a false positive.
// Test case which in the past triggered a false positive.
@interface RDar8356342
- (NSDate*) rdar8356342:(NSDate *)inValue;
@end
@@ -1612,8 +1575,7 @@ void r8272168(void) {
}
@end
// <rdar://problem/8724287> - This test case previously crashed because
// of a bug in BugReporter.
// This test case previously crashed because of a bug in BugReporter.
extern const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key) CF_RETURNS_NOT_RETAINED;
typedef struct __CFError * CFErrorRef;
extern const CFStringRef kCFErrorUnderlyingErrorKey;
@@ -1635,8 +1597,8 @@ static void rdar_8724287(CFErrorRef error)
}
}
// <rdar://problem/9234108> - Make sure the model applies cf_consumed
// correctly in argument positions besides the first.
// Make sure the model applies cf_consumed correctly in argument positions
// besides the first.
CF_IMPLICIT_BRIDGING_ENABLED
@@ -1649,8 +1611,7 @@ void rdar_9234108(void) {
rdar_9234108_helper(0, CFStringCreate());
}
// <rdar://problem/9726279> - Make sure that objc_method_family works
// to override naming conventions.
// Make sure that objc_method_family works to override naming conventions.
struct TwoDoubles {
double one;
double two;
@@ -1674,7 +1635,6 @@ void rdar9726279(void) {
[value release];
}
// <rdar://problem/9732321>
// Test camelcase support for CF conventions. While Core Foundation APIs
// don't use camel casing, other code is allowed to use it.
CFArrayRef camelcase_create_1(void) {
@@ -1726,7 +1686,6 @@ CFArrayRef camel_copymachine(void) {
return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}}
}
// rdar://problem/8024350
@protocol F18P
- (id) clone;
@end
@@ -1741,7 +1700,6 @@ CFArrayRef camel_copymachine(void) {
}
@end
// Radar 6582778.
void rdar6582778(void) {
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
CFTypeRef vals[] = { CFDateCreate(0, t) }; // expected-warning {{leak}}
@@ -1754,9 +1712,7 @@ void rdar6582778_2(void) {
global = CFDateCreate(0, t); // no-warning
}
// <rdar://problem/10232019> - Test that objects passed to containers
// are marked "escaped".
// Test that objects passed to containers are marked "escaped".
void rdar10232019(void) {
NSMutableArray *array = [NSMutableArray array];
@@ -1779,7 +1735,6 @@ void rdar10232019_positive(void) {
}
// RetainCountChecker support for XPC.
// <rdar://problem/9658496>
typedef void * xpc_object_t;
xpc_object_t _CFXPCCreateXPCObjectFromCFObject(CFTypeRef cf);
void xpc_release(xpc_object_t object);
@@ -2085,9 +2040,8 @@ static int Cond;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/13783514> xpc_connection_set_finalizer_f
// xpc_connection_set_finalizer_f
//===----------------------------------------------------------------------===//
typedef xpc_object_t xpc_connection_t;
typedef void (*xpc_finalizer_t)(void *value);
void xpc_connection_set_context(xpc_connection_t connection, void *ctx);

View File

@@ -177,7 +177,6 @@ DEPRECATED
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end
// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))
@@ -216,7 +215,6 @@ DEPRECATED
@end
// rdar://15082818
@class NSMutableDictionary;
@interface NSArray

View File

@@ -154,7 +154,6 @@ DEPRECATED
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end
// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))
@@ -191,7 +190,6 @@ DEPRECATED
@end
// rdar://15082818
@class NSMutableDictionary;
@interface NSArray

View File

@@ -100,7 +100,6 @@ void boxString() {
static const char strarr[] = "coolbox";
s = [NSString stringWithUTF8String:strarr];
// rdar://18080352
const char *utf8Bytes = "blah";
NSString *string1 = [NSString stringWithUTF8String:utf8Bytes];
NSString *string2 = [[NSString alloc] initWithUTF8String:utf8Bytes];

View File

@@ -100,7 +100,6 @@ void boxString() {
static const char strarr[] = "coolbox";
s = @(strarr);
// rdar://18080352
const char *utf8Bytes = "blah";
NSString *string1 = @(utf8Bytes);
NSString *string2 = @(utf8Bytes);

View File

@@ -2,7 +2,6 @@
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
// rdar://15396636
#ifndef NS_RETURNS_INNER_POINTER // defined in iOS 6 for sure
#define NS_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer))
@@ -109,7 +108,6 @@ CF_IMPLICIT_BRIDGING_DISABLED
- (JSObjectRef*)JSObject2;
@end
// rdar://15044991
typedef void *SecTrustRef;
@interface NSURLProtectionSpace

View File

@@ -2,7 +2,6 @@
// RUN: %clang_cc1 -objcmt-migrate-all -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
// rdar://15396636
#ifndef NS_RETURNS_INNER_POINTER // defined in iOS 6 for sure
#define NS_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer))
@@ -109,7 +108,6 @@ CF_IMPLICIT_BRIDGING_DISABLED
@property (nonatomic, readonly) JSObjectRef *JSObject2;
@end
// rdar://15044991
typedef void *SecTrustRef;
@interface NSURLProtectionSpace

View File

@@ -214,7 +214,6 @@ typedef enum {
Random6
} UIP8_3;
// rdar://15200602
#define NS_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X)))
#define NS_ENUM_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X)))
@@ -225,10 +224,8 @@ enum {
} NS_ENUM_AVAILABLE_MAC(10.9);
typedef NSInteger NSModalResponse NS_AVAILABLE_MAC(10.9);
// rdar://15201056
typedef NSUInteger FarFarAwayOptions;
// rdar://15200915
typedef NSUInteger FarAwayOptions;
enum {
NSWorkspaceLaunchAndPrint = 0x00000002,
@@ -281,7 +278,6 @@ enum {
FarFarAway2 = 1 << 2
};
// rdar://15200915
typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) {
NSWindowOcclusionStateVisible = 1UL << 1,
};
@@ -304,14 +300,12 @@ enum {
NSWindowDocumentIconButton
};
// rdar://18262255
typedef enum : NSUInteger {
ThingOne,
ThingTwo,
ThingThree,
} Thing;
// rdar://18498539
typedef enum {
one = 1
} NumericEnum;
@@ -331,7 +325,6 @@ typedef enum {
NumericEnum4;
// rdar://18532199
enum
{
UI8one = 1
@@ -364,7 +357,6 @@ enum
};
typedef uint8_t UI8Type;
// rdar://19352510
typedef enum : NSInteger {zero} MyEnum;
typedef enum : NSUInteger {two} MyEnumNSUInteger;
@@ -380,7 +372,6 @@ typedef enum : unsigned long long {
ll4
} MyEnumunsignedlonglong;
// rdar://19994496
typedef enum : int8_t {int8_one} MyOneEnum;
typedef enum : int16_t {

View File

@@ -205,7 +205,6 @@ typedef NS_ENUM(unsigned int, UIP8_3) {
Random6
};
// rdar://15200602
#define NS_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X)))
#define NS_ENUM_AVAILABLE_MAC(X) __attribute__((availability(macosx,introduced=X)))
@@ -215,10 +214,8 @@ typedef NS_ENUM(NSInteger, NSModalResponse) {
NSModalResponseContinue = (-1002),
} NS_ENUM_AVAILABLE_MAC(10.9);
// rdar://15201056
typedef NSUInteger FarFarAwayOptions;
// rdar://15200915
typedef NS_OPTIONS(NSUInteger, FarAwayOptions) {
FarAway1 = 1 << 1,
FarAway2 = 1 << 2
@@ -266,7 +263,6 @@ enum {
FarFarAway2 = 1 << 2
};
// rdar://15200915
typedef NS_OPTIONS(NSUInteger, NSWindowOcclusionState) {
NSWindowOcclusionStateVisible = 1UL << 1,
};
@@ -287,14 +283,12 @@ typedef NS_ENUM(NSUInteger, NSSelectionDirection) {
// standard window buttons
// rdar://18262255
typedef NS_ENUM(NSUInteger, Thing) {
ThingOne,
ThingTwo,
ThingThree,
};
// rdar://18498539
typedef NS_ENUM(unsigned int, NumericEnum) {
one = 1
};
@@ -311,7 +305,6 @@ typedef NS_OPTIONS(unsigned int, NumericEnum4) {
Four = 4
};
// rdar://18532199
typedef NS_ENUM(int8_t, MyEnumeratedType)
{
UI8one = 1
@@ -340,7 +333,6 @@ typedef NS_ENUM(uint8_t, UI8Type)
UIU8one = 1
};
// rdar://19352510
typedef NS_ENUM(NSInteger, MyEnum) {zero};
typedef NS_ENUM(NSUInteger, MyEnumNSUInteger) {two};
@@ -356,7 +348,6 @@ typedef NS_ENUM(unsigned long long, MyEnumunsignedlonglong) {
ll4
};
// rdar://19994496
typedef NS_ENUM(int8_t, MyOneEnum) {int8_one};
typedef NS_ENUM(int16_t, Myint16_tEnum) {

View File

@@ -8,7 +8,6 @@
#define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
#define DEPRECATED __attribute__((deprecated))
// rdar://15442742
#if TARGET_OS_IPHONE
#define NS_NONATOMIC_IOSONLY nonatomic
#else
@@ -184,7 +183,6 @@ DEPRECATED
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end
// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))
@@ -223,7 +221,6 @@ DEPRECATED
@end
// rdar://15082818
@class NSMutableDictionary;
@interface NSArray

View File

@@ -8,7 +8,6 @@
#define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER
#define DEPRECATED __attribute__((deprecated))
// rdar://15442742
#if TARGET_OS_IPHONE
#define NS_NONATOMIC_IOSONLY nonatomic
#else
@@ -161,7 +160,6 @@ DEPRECATED
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end
// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))
@@ -198,7 +196,6 @@ DEPRECATED
@end
// rdar://15082818
@class NSMutableDictionary;
@interface NSArray

View File

@@ -108,7 +108,6 @@ CF_IMPLICIT_BRIDGING_DISABLED
- (JSObjectRef*)JSObject2;
@end
// rdar://15044991
typedef void *SecTrustRef;
@interface NSURLProtectionSpace

View File

@@ -108,7 +108,6 @@ CF_IMPLICIT_BRIDGING_DISABLED
- (JSObjectRef*)JSObject2 NS_RETURNS_INNER_POINTER;
@end
// rdar://15044991
typedef void *SecTrustRef;
@interface NSURLProtectionSpace

View File

@@ -2,7 +2,6 @@
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
// rdar://15300059
#define __NSi_7_0 introduced=7.0

View File

@@ -2,7 +2,6 @@
// RUN: %clang_cc1 -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result
// rdar://15300059
#define __NSi_7_0 introduced=7.0

View File

@@ -5,12 +5,10 @@
@class NSString;
// rdar://19140267
@protocol NSObject
@property (readonly, copy) NSString *description;
@end
// rdar://18498572
@interface NSObject <NSObject> @end
@interface P : NSObject
@@ -47,7 +45,6 @@ P* fun(void);
- (NSString *)description { return [super description]; }
@end
// rdar://19140267
@interface Sub : P
@end
@@ -78,7 +75,6 @@ id testRdar19038838(Rdar19038838 *obj) {
return [obj newItem];
}
// rdar://19381786
@interface rdar19381786 : NSObject
{
rdar19381786* obj;
@@ -99,7 +95,6 @@ id testRdar19038838(Rdar19038838 *obj) {
}
@end
// rdar://19140114
int NSOnState;
int ArrNSOnState[4];
@interface rdar19140114 : NSObject

View File

@@ -5,12 +5,10 @@
@class NSString;
// rdar://19140267
@protocol NSObject
@property (readonly, copy) NSString *description;
@end
// rdar://18498572
@interface NSObject <NSObject> @end
@interface P : NSObject
@@ -47,7 +45,6 @@ P* fun(void);
- (NSString *)description { return super.description; }
@end
// rdar://19140267
@interface Sub : P
@end
@@ -78,7 +75,6 @@ id testRdar19038838(Rdar19038838 *obj) {
return obj.newItem;
}
// rdar://19381786
@interface rdar19381786 : NSObject
{
rdar19381786* obj;
@@ -99,7 +95,6 @@ id testRdar19038838(Rdar19038838 *obj) {
}
@end
// rdar://19140114
int NSOnState;
int ArrNSOnState[4];
@interface rdar19140114 : NSObject

View File

@@ -70,7 +70,6 @@ typedef char BOOL;
- (id) dataSource;
// rdar://15509831
- (id)delegate;
- (id)xxxdelegateYYY;
@@ -180,7 +179,6 @@ DEPRECATED
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end
// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))
@@ -219,7 +217,6 @@ DEPRECATED
@end
// rdar://15082818
@class NSMutableDictionary;
@interface NSArray
@@ -231,7 +228,6 @@ DEPRECATED
- (void) setMyFuncptr : (id (*)(id, NSArray *, NSMutableDictionary *)) bl;
@end
// rdar://15231241
@interface rdar15231241
@property (nonatomic, readonly) double Ddelegate;
@property (nonatomic, readonly) float Fdelegate;
@@ -239,7 +235,6 @@ DEPRECATED
@property (nonatomic, readonly) BOOL Bdelegate;
@end
// rdar://19372798
@protocol NSObject @end
@protocol MyProtocol <NSObject>
- (id)readonlyProperty;

View File

@@ -61,7 +61,6 @@ typedef char BOOL;
@property (nonatomic, assign) id dataSource;
// rdar://15509831
@property (nonatomic, readonly, assign) id delegate;
@property (nonatomic, assign) id xxxdelegateYYY;
@@ -157,7 +156,6 @@ DEPRECATED
- (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
@end
// rdar://14987909
#define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
#define NORETURN __attribute__((noreturn))
#define ALIGNED __attribute__((aligned(16)))
@@ -194,7 +192,6 @@ DEPRECATED
@end
// rdar://15082818
@class NSMutableDictionary;
@interface NSArray
@@ -204,7 +201,6 @@ DEPRECATED
@property (nonatomic) id (*MyFuncptr)(id, NSArray *, NSMutableDictionary *);
@end
// rdar://15231241
@interface rdar15231241
@property (nonatomic, readonly) double Ddelegate;
@property (nonatomic, readonly) float Fdelegate;
@@ -212,7 +208,6 @@ DEPRECATED
@property (nonatomic, readonly) BOOL Bdelegate;
@end
// rdar://19372798
@protocol NSObject @end
@protocol MyProtocol <NSObject>
@property (nonatomic, readonly, strong) id readonlyProperty;

View File

@@ -112,7 +112,6 @@
@implementation Test7
@end
// rdar://15515206
@interface BTLEBrowser
@end

View File

@@ -112,7 +112,6 @@
@implementation Test7
@end
// rdar://15515206
@interface BTLEBrowser
@end

View File

@@ -2,8 +2,6 @@
// RUN: %clang_cc1 -fmodules -objcmt-migrate-ns-macros -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// rdar://18498550
typedef long NSInteger;
enum {
UIViewNone = 0x0,

View File

@@ -2,8 +2,6 @@
// RUN: %clang_cc1 -fmodules -objcmt-migrate-ns-macros -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11
// RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result
// rdar://18498550
typedef long NSInteger;
#ifndef NS_ENUM
@import Foundation;

View File

@@ -222,8 +222,8 @@
#endif
@end
// <rdar://problem/6380411>: 'myproperty' has kind 'assign' and thus the
// assignment through the setter does not perform a release.
// 'myproperty' has kind 'assign' and thus the assignment through the setter
// does not perform a release.
@interface MyObject : NSObject {
id __unsafe_unretained _myproperty;

View File

@@ -18,7 +18,6 @@ typedef unsigned long NSUInteger;
typedef struct objc_selector *SEL;
//===------------------------------------------------------------------------===
// <rdar://problem/6953275>
// Check that 'self' is not referenced after calling '[super dealloc]'.
@interface SuperDeallocThenReleaseIvarClass : NSObject {

File diff suppressed because it is too large Load Diff

View File

@@ -157,7 +157,6 @@ NSString* f10(void) {
return s; // no-warning
}
// Test case for regression reported in <rdar://problem/6452745>.
// Essentially 's' should not be considered allocated on the false branch.
// This exercises the 'EvalAssume' logic in GRTransferFuncs (CFRefCount.cpp).
NSString* f11(CFDictionaryRef dict, const char* key) {
@@ -368,7 +367,7 @@ void test_objc_atomicCompareAndSwap_parameter_no_direct_release(NSString **old)
}
// Test stringWithFormat (<rdar://problem/6815234>)
// Test stringWithFormat
void test_stringWithFormat(void) {
NSString *string = [[NSString stringWithFormat:@"%ld", (long) 100] retain];
[string release];

View File

@@ -3,7 +3,7 @@
// Test handling of OSAtomicCompareAndSwap when C++ inserts "no-op" casts and we
// do a forced load and binding to the environment on an expression that would regularly
// not have an environment binding. This previously triggered a crash (<rdar://problem/9339920>).
// not have an environment binding. This previously triggered a crash.
// NOTE: It is critical that the function called is OSAtomicCompareAndSwapIntBarrier.
bool OSAtomicCompareAndSwapIntBarrier( int __oldValue, int __newValue, volatile int *__theValue ) ;
static int _rdar9339920_x = 0;

View File

@@ -1,7 +1,5 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
// rdar://problem/64202361
struct A {
int a;
struct {

View File

@@ -38,7 +38,6 @@ void f1(NestedNonnullMember *Root) {
// Check that we correctly process situations when non-pointer parameters
// get nonnul attributes.
// Original problem: rdar://problem/63150074
typedef struct {
long a;
} B;

View File

@@ -57,7 +57,7 @@ void struct_as_array(void) {
}
// PR13264 / <rdar://problem/11802440>
// PR13264
struct point { int x; int y; };
struct circle { struct point o; int r; };
struct circle get_circle(void) {

View File

@@ -104,7 +104,6 @@ void test2_c(void) {
void testMessaging(void) {
// <rdar://problem/12119814>
[[^(void){} copy] release];
}
@@ -116,7 +115,7 @@ void testMessaging(void) {
- (void)test {
// At one point this crashed because we created a path note at a
// PreStmtPurgeDeadSymbols point but only knew how to deal with PostStmt
// points. <rdar://problem/12687586>
// points.
extern dispatch_queue_t queue;
@@ -172,7 +171,6 @@ void blockCapturesItselfInTheLoop(int x, int m) {
// Blocks that called the function they were contained in that also have
// static locals caused crashes.
// rdar://problem/21698099
void takeNonnullBlock(void (^)(void)) __attribute__((nonnull));
void takeNonnullIntBlock(int (^)(void)) __attribute__((nonnull));

View File

@@ -112,7 +112,6 @@ typedef unsigned int NSUInteger;
@implementation Test
// <rdar://problem/9241180> for subscripting
- (id)testUninitializedObject:(BOOL)keyed {
Test *o;
if (keyed) {

View File

@@ -78,7 +78,7 @@ void testReferenceStruct() {
}
// FIXME: This test is split into two functions because region invalidation
// does not preserve reference bindings. <rdar://problem/13320347>
// does not preserve reference bindings.
void testConstReferenceStruct() {
int x;
RefWrapper w = { x };

View File

@@ -1,7 +1,6 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -verify %s
// expected-no-diagnostics
// This test case was reported in <rdar:problem/6080742>.
// It tests path-sensitivity with respect to '!(cfstring != 0)' (negation of inequality).
int printf(const char *restrict,...);

View File

@@ -156,7 +156,6 @@ int f14(int count) {
return index;
}
// Test case for <rdar://problem/6248086>
void f15(unsigned x, unsigned y) {
int count = x * y; // no-warning
int z[count]; // non-nested-warning {{unused variable 'z'}}
@@ -176,7 +175,6 @@ void f17(void) {
x = x;
}
// <rdar://problem/6506065>
// The values of dead stores are only "consumed" in an enclosing expression
// what that value is actually used. In other words, don't say "Although the
// value stored to 'x' is used...".
@@ -520,7 +518,7 @@ void rdar8014335(void) {
}
}
// <rdar://problem/8320674> NullStmts followed by do...while() can lead to disconnected CFG
// NullStmts followed by do...while() can lead to disconnected CFG
//
// This previously caused bogus dead-stores warnings because the body of the first do...while was
// disconnected from the entry of the function.

View File

@@ -17,7 +17,7 @@ id foo(int x) {
return title;
}
// <rdar://problem/8808566> Static analyzer is wrong: NSWidth(imgRect) not understood as unconditional assignment
// Static analyzer is wrong: NSWidth(imgRect) not understood as unconditional assignment
//
// Note: this requires inlining support. This previously issued a false positive use of
// uninitialized value when calling NSWidth.

View File

@@ -82,7 +82,6 @@ extern void *_NSConstantStringClassReference;
// Test cases.
//===----------------------------------------------------------------------===//
// <rdar://problem/6062730>
// The analyzer doesn't perform any inter-procedural analysis, so delegates
// involving [NSObject performSelector...] tend to lead to false positives.
// For now the analyzer just stops tracking the reference count of the

View File

@@ -110,7 +110,7 @@ int test_cond_assign() {
//===----------------------------------------------------------------------===//
// <rdar://problem/8331641> leak reports should not show paths that end with exit() (but ones that don't end with exit())
// leak reports should not show paths that end with exit() (but ones that don't end with exit())
void stop() __attribute__((noreturn));
@@ -406,7 +406,6 @@ void testCast(int coin) {
}
// The following previously crashed when generating extensive diagnostics.
// <rdar://problem/10797980>
@interface RDar10797980_help
@property (readonly) int x;
@end
@@ -425,7 +424,7 @@ void testCast(int coin) {
// The original source for the above Radar contains another problem:
// if the end-of-path node is an implicit statement, it may not have a valid
// source location. <rdar://problem/12446776>
// source location.
- (void)test2 {
if (bar_cond_assign()) {
id foo = [[RDar10797980 alloc] init]; // leak

View File

@@ -374,8 +374,8 @@ void testGetMostInformativeDerivedForId(NSArray<NSString *> *a,
id idB = b;
a = idB; // expected-warning {{Conversion from value of type 'UnrelatedTypeGeneric<NSString *> *' to incompatible type 'NSArray<NSString *> *'}}
// rdar://problem/26086914 crash here caused by symbolic type being unrelated
// to compile-time source type of cast.
// crash here caused by symbolic type being unrelated to compile-time source
// type of cast.
id x = a; // Compile-time type is NSArray<>, Symbolic type is UnrelatedTypeGeneric<>.
[x takesType:[[NSNumber alloc] init]]; // expected-warning {{Conversion from value of type 'NSNumber *' to incompatible type 'NSString *'}}
}

View File

@@ -2,7 +2,6 @@
// RUN: %clang_analyze_cc1 -analyzer-config eagerly-assume=false %s -analyzer-checker=core.NullDereference,core.DivideZero -fblocks -analyzer-output=plist -analyzer-config suppress-null-return-paths=false -o %t
// RUN: %normalize_plist <%t | diff -ub %S/Inputs/expected-plists/inline-plist.c.plist -
// <rdar://problem/10967815>
void mmm(int y) {
if (y != 0)
y++;

View File

@@ -1734,12 +1734,12 @@
<key>start</key>
<array>
<dict>
<key>line</key><integer>167</integer>
<key>line</key><integer>166</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>167</integer>
<key>line</key><integer>166</integer>
<key>col</key><integer>8</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1747,12 +1747,12 @@
<key>end</key>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1768,12 +1768,12 @@
<key>start</key>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1781,12 +1781,12 @@
<key>end</key>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1798,7 +1798,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1806,12 +1806,12 @@
<array>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>34</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1827,7 +1827,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1835,24 +1835,24 @@
<array>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>11</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>47</integer>
<key>file</key><integer>0</integer>
</dict>
</array>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>12</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>34</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1872,12 +1872,12 @@
<key>start</key>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>10</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>10</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1885,12 +1885,12 @@
<key>end</key>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1906,12 +1906,12 @@
<key>start</key>
<array>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>170</integer>
<key>line</key><integer>169</integer>
<key>col</key><integer>4</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1919,12 +1919,12 @@
<key>end</key>
<array>
<dict>
<key>line</key><integer>177</integer>
<key>line</key><integer>176</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>177</integer>
<key>line</key><integer>176</integer>
<key>col</key><integer>8</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1936,7 +1936,7 @@
<key>kind</key><string>event</string>
<key>location</key>
<dict>
<key>line</key><integer>177</integer>
<key>line</key><integer>176</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1944,12 +1944,12 @@
<array>
<array>
<dict>
<key>line</key><integer>177</integer>
<key>line</key><integer>176</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
<dict>
<key>line</key><integer>177</integer>
<key>line</key><integer>176</integer>
<key>col</key><integer>10</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1973,7 +1973,7 @@
<key>issue_hash_function_offset</key><string>11</string>
<key>location</key>
<dict>
<key>line</key><integer>177</integer>
<key>line</key><integer>176</integer>
<key>col</key><integer>3</integer>
<key>file</key><integer>0</integer>
</dict>
@@ -1982,12 +1982,12 @@
<key>0</key>
<array>
<integer>13</integer>
<integer>165</integer>
<integer>166</integer>
<integer>167</integer>
<integer>168</integer>
<integer>170</integer>
<integer>175</integer>
<integer>177</integer>
<integer>169</integer>
<integer>174</integer>
<integer>176</integer>
</array>
</dict>
</dict>

View File

@@ -11,7 +11,7 @@ int compute(void) {
// Do something that will take enough processing to trigger trimming.
// FIXME: This is actually really sensitive. If the interval timing is just
// wrong, the node for the actual dereference may also be collected, and all
// the path notes will disappear. <rdar://problem/12511814>
// the path notes will disappear.
return 2 + 3 + 4 + 5 + 6;
}

View File

@@ -254,7 +254,6 @@ void inlinedIsDifferent(int inlined) {
}
void testInlinedIsDifferent(void) {
// <rdar://problem/13787723>
inlinedIsDifferent(0);
}

View File

@@ -162,7 +162,6 @@ id testCreateArrayLiteral(id myNil) {
//expected-note@-1 {{Array element cannot be nil}}
}
// <rdar://problem/14611722>
id testAutoreleaseTakesEffectInDispatch(void) {
static dispatch_once_t token = 0;
dispatch_once(&token, ^{});

View File

@@ -101,7 +101,7 @@ int uafAndCallsFooWithEmptyReturn(void) {
// If we inline any of the malloc-family functions, the checker shouldn't also
// try to do additional modeling. <rdar://problem/12317671>
// try to do additional modeling.
char *strndup(const char *str, size_t n) {
if (!str)
return 0;

View File

@@ -89,7 +89,6 @@ void use_ret(void) {
// Passing a block as a parameter to an inlined call for which we generate
// a stack hint message caused crashes.
// rdar://problem/21291971
void myfree_takingblock(void (^ignored)(void), int *p) {
free(p);
}

View File

@@ -1230,7 +1230,6 @@ int my_main_warn(FILE *f) {
return 0;// expected-warning {{leak}}
}
// <rdar://problem/10978247>.
// some people use stack allocated memory as an optimization to avoid
// a heap allocation for small work sizes. This tests the analyzer's
// understanding that the malloc'ed memory is not the same as stackBuffer.
@@ -1263,9 +1262,9 @@ void radar10978247_positive(int myValueSize) {
else
return; // expected-warning {{leak}}
}
// <rdar://problem/11269741> Previously this triggered a false positive
// because malloc() is known to return uninitialized memory and the binding
// of 'o' to 'p->n' was not getting propertly handled. Now we report a leak.
// Previously this triggered a false positive because malloc() is known to
// return uninitialized memory and the binding of 'o' to 'p->n' was not getting
// propertly handled. Now we report a leak.
struct rdar11269741_a_t {
struct rdar11269741_b_t {
int m;

View File

@@ -1,9 +1,8 @@
// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -analyzer-checker=core,alpha.core -verify -fblocks %s
// expected-no-diagnostics
// <rdar://problem/6440393> - A bunch of misc. failures involving evaluating
// these expressions and building CFGs. These tests are here to prevent
// regressions.
// A bunch of misc. failures involving evaluating these expressions and
// building CFGs. These tests are here to prevent regressions.
typedef long long int64_t;
@class NSString, NSDictionary;
typedef long NSInteger;
@@ -22,13 +21,12 @@ void rdar_6440393_1(NSDictionary *dict) {
shazam(x, &bufptr);
}
// <rdar://problem/6845148> - In this example we got a signedness
// mismatch between the literal '0' and the value of 'scrooge'. The
// trick is to have the evaluator convert the literal to an unsigned
// integer when doing a comparison with the pointer. This happens
// because of the transfer function logic of
// OSAtomicCompareAndSwap64Barrier, which doesn't have special casts
// in place to do this for us.
// In this example we got a signedness mismatch between the literal '0' and the
// value of 'scrooge'. The trick is to have the evaluator convert the literal
// to an unsigned integer when doing a comparison with the pointer. This
// happens because of the transfer function logic of
// OSAtomicCompareAndSwap64Barrier, which doesn't have special casts in place
// to do this for us.
_Bool OSAtomicCompareAndSwap64Barrier( int64_t __oldValue, int64_t __newValue, volatile int64_t *__theValue );
extern id objc_lookUpClass(const char *name);
void rdar_6845148(id debug_yourself) {

View File

@@ -1,8 +1,7 @@
// RUN: %clang_analyze_cc1 -triple thumbv7-apple-ios0.0.0 -target-feature +neon -analyzer-checker=core -verify -fblocks -Wno-objc-root-class %s
// expected-no-diagnostics
// <rdar://problem/11405978> - Handle casts of vectors to structs, and loading
// a value.
// Handle casts of vectors to structs, and loading a value.
typedef float float32_t;
typedef __attribute__((neon_vector_type(2))) float32_t float32x2_t;

View File

@@ -43,8 +43,6 @@ void handle_assign_of_condition(int x) {
}
}
// From <rdar://problem/6619921>
//
// In this test case, 'needsAnArray' is a signed char. The analyzer tracks
// a symbolic value for this variable, but in the branch condition it is
// promoted to 'int'. Currently the analyzer doesn't reason well about
@@ -82,7 +80,6 @@ void pr3836(int *a, int *b) {
//===---------------------------------------------------------------------===//
// <rdar://problem/7342806>
// This false positive occurred because the symbolic constraint on a short was
// not maintained via sign extension. The analyzer doesn't properly handle
// the sign extension, but now tracks the constraint. This particular

View File

@@ -1,6 +1,5 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -verify -fblocks %s
// <rdar://problem/6776949>
// main's 'argc' argument is always > 0
int main(int argc, char* argv[]) {
int *p = 0;

View File

@@ -144,7 +144,7 @@ void pr7675_test() {
clang_analyzer_warnIfReached(); // expected-warning{{REACHABLE}}
}
// <rdar://problem/8375510> - CFGBuilder should handle temporaries.
// CFGBuilder should handle temporaries.
struct R8375510 {
R8375510();
~R8375510();
@@ -629,7 +629,7 @@ void test_alloca_in_a_recursive_function(int p1) {
// variable whose sub-field is also a struct. This currently
// results in a CXXTempObjectRegion being created, but not
// properly handled. For now, we just ignore that value
// to avoid a crash (<rdar://problem/12753384>).
// to avoid a crash.
struct RDar12753384_ClassA {
unsigned z;
};
@@ -648,7 +648,6 @@ unsigned RDar12753384() {
// warning because the anonymous union resulting in a temporary object
// getting put into the initializer. We still aren't handling this correctly,
// but now if a temporary object appears in an initializer we just ignore it.
// Fixes <rdar://problem/12755044>.
struct Rdar12755044_foo
{

View File

@@ -153,7 +153,6 @@ again:
}
//===----------------------------------------------------------------------===//
// Reduced test case from <rdar://problem/7114618>.
// Basically a null check is performed on the field value, which is then
// assigned to a variable and then checked again.
//===----------------------------------------------------------------------===//
@@ -182,7 +181,6 @@ void f(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7185607>
// Bit-fields of a struct should be invalidated when blasting the entire
// struct with an integer constant.
//===----------------------------------------------------------------------===//
@@ -197,8 +195,7 @@ int rdar_test_7185607(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7242006> [RegionStore] compound literal assignment with
// floats not honored
// [RegionStore] compound literal assignment with floats not honored
// This test case is mirrored in misc-ps.m, but this case is a negative.
//===----------------------------------------------------------------------===//
typedef float CGFloat;
@@ -213,9 +210,8 @@ CGFloat rdar7242006_negative(CGFloat x) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7249340> - Allow binding of values to symbolic regions.
// This test case shows how RegionStore tracks the value bound to 'x'
// after the assignment.
// Allow binding of values to symbolic regions. This test case shows how
// RegionStore tracks the value bound to 'x' after the assignment.
//===----------------------------------------------------------------------===//
typedef int* ptr_rdar_7249340;
void rdar_7249340(ptr_rdar_7249340 x) {
@@ -227,11 +223,11 @@ void rdar_7249340(ptr_rdar_7249340 x) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7249327> - This test case tests both value tracking of
// array values and that we handle symbolic values that are casted
// between different integer types. Note the assignment 'n = *a++'; here
// 'n' is and 'int' and '*a' is 'unsigned'. Previously we got a false positive
// at 'x += *b++' (undefined value) because we got a false path.
// This test case tests both value tracking of array values and that we handle
// symbolic values that are casted between different integer types. Note the
// assignment 'n = *a++'; here 'n' is and 'int' and '*a' is 'unsigned'.
// Previously we got a false positive at 'x += *b++' (undefined value) because
// we got a false path.
//===----------------------------------------------------------------------===//
int rdar_7249327_aux(void);
@@ -259,8 +255,8 @@ void rdar_7249327(unsigned int A[2*32]) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6914474> - Check that 'x' is invalidated because its
// address is passed in as a value to a struct.
// Check that 'x' is invalidated because its address is passed in as a value to
// a struct.
//===----------------------------------------------------------------------===//
struct doodad_6914474 { int *v; };
extern void prod_6914474(struct doodad_6914474 *d);
@@ -304,8 +300,7 @@ int test_handle_array_wrapper(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7261075> [RegionStore] crash when
// handling load: '*((unsigned int *)"????")'
// [RegionStore] crash when handling load: '*((unsigned int *)"????")'
//===----------------------------------------------------------------------===//
int rdar_7261075(void) {
@@ -316,8 +311,7 @@ int rdar_7261075(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7275774> false path due to limited pointer
// arithmetic constraints
// False path due to limited pointer arithmetic constraints.
//===----------------------------------------------------------------------===//
void rdar_7275774(void *data, unsigned n) {
@@ -335,8 +329,6 @@ void rdar_7275774(void *data, unsigned n) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7312221>
//
// Test that Objective-C instance variables aren't prematurely pruned
// from the analysis state.
//===----------------------------------------------------------------------===//
@@ -386,7 +378,7 @@ void doSomething_7312221_with_struct(struct rdar_7312221_container *Self) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7332673> - Just more tests cases for regions
// Just more tests cases for regions
//===----------------------------------------------------------------------===//
void rdar_7332673_test1(void) {
@@ -400,11 +392,10 @@ void rdar_7332673_test2(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7347252>: Because of a bug in
// RegionStoreManager::RemoveDeadBindings(), the symbol for s->session->p
// would incorrectly be pruned from the state after the call to
// rdar7347252_malloc1(), and would incorrectly result in a warning about
// passing a null pointer to rdar7347252_memcpy().
// Because of a bug in RegionStoreManager::RemoveDeadBindings(), the symbol for
// s->session->p would incorrectly be pruned from the state after the call to
// rdar7347252_malloc1(), and would incorrectly result in a warning about
// passing a null pointer to rdar7347252_memcpy().
//===----------------------------------------------------------------------===//
struct rdar7347252_AA { char *p;};
@@ -485,8 +476,8 @@ int pr3135(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7403269> - Test that we handle compound initializers with
// partially unspecified array values. Previously this caused a crash.
// Test that we handle compound initializers with partially unspecified array
// values. Previously this caused a crash.
//===----------------------------------------------------------------------===//
typedef struct RDar7403269 {
@@ -526,7 +517,6 @@ void rdar7403269_b_pos(void) {
//===----------------------------------------------------------------------===//
// Test that incrementing a non-null pointer results in a non-null pointer.
// (<rdar://problem/7191542>)
//===----------------------------------------------------------------------===//
void test_increment_nonnull_rdar_7191542(const char *path) {
@@ -547,7 +537,7 @@ void test_increment_nonnull_rdar_7191542(const char *path) {
//===----------------------------------------------------------------------===//
// Test that the store (implicitly) tracks values for doubles/floats that are
// uninitialized (<rdar://problem/6811085>)
// uninitialized.
//===----------------------------------------------------------------------===//
double rdar_6811085(void) {
@@ -647,8 +637,8 @@ unsigned rdar7582031_static(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7462324> - Test that variables passed using __blocks
// are not treated as being uninitialized.
// Test that variables passed using __blocks are not treated as being
// uninitialized.
//===----------------------------------------------------------------------===//
typedef void (^RDar_7462324_Callback)(id obj);
@@ -682,8 +672,8 @@ typedef void (^RDar_7462324_Callback)(id obj);
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/7468209> - Scanning for live variables within a block should
// not crash on variables passed by reference via __block.
// Scanning for live variables within a block should not crash on variables
// passed by reference via __block.
//===----------------------------------------------------------------------===//
int rdar7468209_aux(void);
@@ -742,7 +732,6 @@ void pr4358(struct pr4358 *pnt) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7526777>
// Test handling fields of values returned from function calls or
// message expressions.
//===----------------------------------------------------------------------===//
@@ -767,8 +756,7 @@ int test_return_struct_2_rdar_7526777(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7527292> Assertion failed: (Op == BinaryOperator::Add ||
// Op == BinaryOperator::Sub)
// Assertion failed: (Op == BinaryOperator::Add || Op == BinaryOperator::Sub)
// This test case previously triggered an assertion failure due to a discrepancy
// been the loaded/stored value in the array
//===----------------------------------------------------------------------===//
@@ -787,8 +775,8 @@ void rdar_7527292(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7515938> - Handle initialization of incomplete arrays
// in structures using a compound value. Previously this crashed.
// Handle initialization of incomplete arrays in structures using a compound
// value. Previously this crashed.
//===----------------------------------------------------------------------===//
struct rdar_7515938 {
@@ -876,8 +864,8 @@ int test_c_rev96062(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7242010> - The access to y[0] at the bottom previously
// was reported as an uninitialized value.
// The access to y[0] at the bottom previously was reported as an uninitialized
// value.
//===----------------------------------------------------------------------===//
char *rdar_7242010(int count, char **y) {
@@ -891,10 +879,6 @@ char *rdar_7242010(int count, char **y) {
return y[0]; // no-warning
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7770737>
//===----------------------------------------------------------------------===//
struct rdar_7770737_s { intptr_t p; };
void rdar_7770737_aux(struct rdar_7770737_s *p);
int rdar_7770737(void)
@@ -958,8 +942,8 @@ void pr6288_b(void) {
*(px[0]) = 0; // no-warning
}
// <rdar://problem/7817800> - A bug in RemoveDeadBindings was causing instance variable bindings
// to get prematurely pruned from the state.
// A bug in RemoveDeadBindings was causing instance variable bindings to get
// prematurely pruned from the state.
@interface Rdar7817800 {
char *x;
}
@@ -987,7 +971,7 @@ void u132monitk (struct pr6036_c *pr6036_d) {
(void) ((struct pr6036_a *) (unsigned long (*)[0]) ((char *) pr6036_d - 1))->pr6036_b; // expected-warning{{Casting a non-structure type to a structure type and accessing a field can lead to memory access errors or data corruption}}
}
// <rdar://problem/7813989> - ?-expressions used as a base of a member expression should be treated as an lvalue
// ?-expressions used as a base of a member expression should be treated as an lvalue
typedef struct rdar7813989_NestedVal { int w; } rdar7813989_NestedVal;
typedef struct rdar7813989_Val { rdar7813989_NestedVal nv; } rdar7813989_Val;
@@ -1017,8 +1001,8 @@ void pr6854(void * arg) {
float f = *(float*) a;
}
// <rdar://problem/8032791> False positive due to symbolic store not find
// value because of 'const' qualifier
// False positive due to symbolic store not find value because of 'const'
// qualifier
double rdar_8032791_2(void);
double rdar_8032791_1(void) {
struct R8032791 { double x[2]; double y; }
@@ -1044,7 +1028,7 @@ void pr_7450(void) {
pr_7450_aux(p + 8);
}
// <rdar://problem/8243408> - Symbolicate struct values returned by value.
// Symbolicate struct values returned by value.
struct s_rdar_8243408 { int x; };
extern struct s_rdar_8243408 rdar_8243408_aux(void);
void rdar_8243408(void) {
@@ -1060,7 +1044,6 @@ void rdar_8243408(void) {
*p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
}
// <rdar://problem/8258814>
int r8258814(void)
{
int foo;
@@ -1169,8 +1152,8 @@ void do_not_crash(int x) {
}
}
// <rdar://problem/8424269> - Handle looking at the size of a VLA in
// ArrayBoundChecker. Nothing intelligent (yet); just don't crash.
// Handle looking at the size of a VLA in ArrayBoundChecker. Nothing
// intelligent (yet); just don't crash.
typedef struct RDar8424269_A {
int RDar8424269_C;
} RDar8424269_A;
@@ -1194,7 +1177,7 @@ static void RDar8424269_B(RDar8424269_A *p, unsigned char *RDar8424269_D,
tmp2 = tmp2t[2];
}
// <rdar://problem/8642434> - Handle transparent unions with the NonNullParamChecker.
// Handle transparent unions with the NonNullParamChecker.
typedef union {
struct rdar_8642434_typeA *_dq;
}
@@ -1209,10 +1192,9 @@ void rdar_8642434_funcB(struct rdar_8642434_typeA *x, struct rdar_8642434_typeA
rdar_8642434_funcA(y); // expected-warning{{Null pointer passed to 1st parameter expecting 'nonnull'}}
}
// <rdar://problem/8848957> - Handle loads and stores from a symbolic index
// into array without warning about an uninitialized value being returned.
// While RegionStore can't fully reason about this example, it shouldn't
// warn here either.
// Handle loads and stores from a symbolic index into array without warning
// about an uninitialized value being returned. While RegionStore can't fully
// reason about this example, it shouldn't warn here either.
typedef struct s_test_rdar8848957 {
int x, y, z;
} s_test_rdar8848957;
@@ -1330,7 +1312,6 @@ void rdar9444714(void) {
}
// Test handling symbolic elements with field accesses.
// <rdar://problem/11127008>
typedef struct {
unsigned value;
} RDar11127008;

View File

@@ -59,7 +59,6 @@ typedef struct _NSRect {
NSSize size;
} NSRect;
// Reduced test case from crash in <rdar://problem/6253157>
@interface A @end
@implementation A
- (void)foo:(void (^)(NSObject *x))block {
@@ -73,9 +72,6 @@ typedef struct _NSRect {
unsigned foo(unsigned x) { return __alignof__((x)) + sizeof(x); }
// Improvement to path-sensitivity involving compound assignments.
// Addresses false positive in <rdar://problem/6268365>
//
unsigned r6268365Aux(void);
void r6268365(void) {
@@ -162,7 +158,6 @@ void pr_3543(void) {
({});
}
// <rdar://problem/6611677>
// This test case test the use of a vector type within an array subscript
// expression.
typedef long long __a64vector __attribute__((__vector_size__(8)));
@@ -222,15 +217,14 @@ void pr3772(void)
// PR 3780 - This tests that StmtIterator isn't broken for VLAs in DeclGroups.
void pr3780(int sz) { typedef double MAT[sz][sz]; }
// <rdar://problem/6695527> - Test that we don't symbolicate doubles before
// we are ready to do something with them.
// Test that we don't symbolicate doubles before we are ready to do something
// with them.
int rdar6695527(double x) {
if (!x) { return 0; }
return 1;
}
// <rdar://problem/6708148> - Test that we properly invalidate structs
// passed-by-reference to a function.
// Test that we properly invalidate structs passed-by-reference to a function.
void pr6708148_invalidate(NSRect *x);
void pr6708148_use(NSRect x);
void pr6708148_test(void) {
@@ -273,7 +267,6 @@ int rdar_10595327(char *str) {
// For pointer arithmetic, --/++ should be treated as preserving non-nullness,
// regardless of how well the underlying StoreManager reasons about pointer
// arithmetic.
// <rdar://problem/6777209>
void rdar_6777209(char *p) {
if (p == 0)
return;
@@ -310,10 +303,9 @@ int test_invalidate_by_ref(void) {
return 0;
}
// Test for <rdar://problem/7027684>. This just tests that the CFG is
// constructed correctly. Previously, the successor block of the entrance
// was the block containing the merge for '?', which would trigger an
// assertion failure.
// This just tests that the CFG is constructed correctly. Previously, the
// successor block of the entrance was the block containing the merge for '?',
// which would trigger an assertion failure.
int rdar_7027684_aux(void);
int rdar_7027684_aux_2(void) __attribute__((noreturn));
void rdar_7027684(int x, int y) {
@@ -337,7 +329,6 @@ void test_cast_from_incomplete_struct(void) {
test_cast_from_incomplete_struct_aux(&_cmd);
}
// Test for <rdar://problem/7034511>
// "ValueManager::makeIntVal(uint64_t X, QualType T) should return a 'Loc'
// when 'T' is a pointer"
//
@@ -413,8 +404,8 @@ void test_trivial_symbolic_comparison(int *x) {
}
// Test for:
// <rdar://problem/7062158> false positive null dereference due to
// BasicStoreManager not tracking *static* globals
// false positive null dereference due to BasicStoreManager not tracking
// *static* globals
//
// This just tests the proper tracking of symbolic values for globals (both
// static and non-static).
@@ -576,8 +567,8 @@ void pr4781(unsigned long *raw1) {
}
}
// <rdar://problem/7185647> - 'self' should be treated as being non-null
// upon entry to an objective-c method.
// 'self' should be treated as being non-null upon entry to an objective-c
// method.
@interface RDar7185647
- (id)foo;
@end
@@ -631,8 +622,8 @@ void test_offsetof_4(void) {
*p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
}
// <rdar://problem/6829164> "nil receiver" false positive: make tracking
// of the MemRegion for 'self' path-sensitive
// "nil receiver" false positive: make tracking of the MemRegion for 'self'
// path-sensitive
@interface RDar6829164 : NSObject {
double x; int y;
}
@@ -654,8 +645,8 @@ double rdar_6829164_2(void);
}
@end
// <rdar://problem/7242015> - Invalidate values passed-by-reference
// to functions when the pointer to the value is passed as an integer.
// Invalidate values passed-by-reference to functions when the pointer to the
// value is passed as an integer.
void test_7242015_aux(unsigned long);
int rdar_7242015(void) {
int x;
@@ -664,8 +655,7 @@ int rdar_7242015(void) {
// using RegionStore.
}
// <rdar://problem/7242006> [RegionStore] compound literal assignment with
// floats not honored
// [RegionStore] compound literal assignment with floats not honored
CGFloat rdar7242006(CGFloat x) {
NSSize y = (NSSize){x, 10};
return y.width; // no-warning
@@ -678,8 +668,7 @@ void pr_4988(void) {
pr_4988; // expected-warning{{expression result unused}}
}
// <rdar://problem/7152418> - A 'signed char' is used as a flag, which is
// implicitly converted to an int.
// A 'signed char' is used as a flag, which is implicitly converted to an int.
void *rdar7152418_bar(void);
@interface RDar7152418 {
signed char x;
@@ -846,8 +835,8 @@ void f(kwset_t *kws, char const *p, char const *q) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7593875> When handling sizeof(VLA) it leads to a hole in
// the ExplodedGraph (causing a false positive)
// When handling sizeof(VLA) it leads to a hole in the ExplodedGraph (causing a
// false positive).
//===----------------------------------------------------------------------===//
int rdar_7593875_aux(int x);
@@ -966,8 +955,8 @@ void pr6938_b(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7979430> - The CFG for code containing an empty
// @synchronized block was previously broken (and would crash the analyzer).
// The CFG for code containing an empty @synchronized block was previously
// broken (and would crash the analyzer).
//===----------------------------------------------------------------------===//
void r7979430(id x) {
@@ -1023,7 +1012,7 @@ void pr7475_warn(void) {
*someStatic = 0; // expected-warning{{null pointer}}
}
// <rdar://problem/8202272> - __imag passed non-complex should not crash
// __imag passed non-complex should not crash
float f0(_Complex float x) {
float l0 = __real x;
return __real l0 + __imag l0;
@@ -1048,8 +1037,8 @@ void reduce_to_constant(int x, int y) {
(void)*(char*)0; // no-warning
}
// <rdar://problem/8360854> - Test that code after a switch statement with no
// 'case:' labels is correctly evaluated.
// Test that code after a switch statement with no 'case:' labels is correctly
// evaluated.
void r8360854(int n) {
switch (n) {
default: ;
@@ -1070,8 +1059,8 @@ void pr8050(struct PR8050 **arg)
*arg = malloc(1);
}
// <rdar://problem/5880430> Switch on enum should not consider default case live
// if all enum values are covered
// Switch on enum should not consider default case live if all enum values are
// covered.
enum Cases { C1, C2, C3, C4 };
void test_enum_cases(enum Cases C) {
switch (C) {
@@ -1096,7 +1085,7 @@ void test_enum_cases_positive(enum Cases C) {
*p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}}
}
// <rdar://problem/6351970> rule request: warn if synchronization mutex can be nil
// Warn if synchronization mutex can be nil
void rdar6351970(void) {
id x = 0;
@synchronized(x) {} // expected-warning{{Nil value used as mutex for @synchronized() (no synchronization will occur)}}
@@ -1126,7 +1115,7 @@ void rdar8578650(id x) {
}
}
// <rdar://problem/6352035> rule request: direct structure member access null pointer dereference
// Direct structure member access null pointer dereference
@interface RDar6352035 {
int c;
}
@@ -1183,7 +1172,6 @@ void baz_pr8440(int n)
// Support direct accesses to non-null memory. Reported in:
// PR 5272
// <rdar://problem/6839683>
int test_direct_address_load(void) {
int *p = (int*) 0x4000;
return *p; // no-warning
@@ -1197,7 +1185,7 @@ void pr5272_test(void) {
// Support casting the return value of function to another different type
// This previously caused a crash, although we likely need more precise
// reasoning here. <rdar://problem/8663544>
// reasoning here.
void* rdar8663544(void);
typedef struct {} Val8663544;
Val8663544 bazR8663544(void) {

View File

@@ -1,6 +1,4 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
// rdar://problem/56586853
// expected-no-diagnostics
struct Data {

View File

@@ -1,7 +1,7 @@
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -verify -Wno-objc-root-class %s
// <rdar://problem/6888289> - This test case shows that a nil instance
// variable can possibly be initialized by a method.
// This test case shows that a nil instance variable can possibly be
// initialized by a method.
@interface RDar6888289
{
id *x;

View File

@@ -232,7 +232,6 @@ int* f10(int* p, signed char x, int y) {
return p;
}
// Test case from <rdar://problem/6407949>
void f11(unsigned i) {
int *x = 0;
if (i >= 0) { // expected-warning{{always true}}

View File

@@ -201,7 +201,7 @@ void test_objc_arrays(void) {
}
}
// <rdar://problem/11059275> - dispatch_set_context and ARC.
// dispatch_set_context and ARC.
__attribute__((cf_returns_retained)) CFTypeRef CFBridgingRetain(id X);
typedef void* dispatch_object_t;
void dispatch_set_context(dispatch_object_t object, const void *context);

View File

@@ -3,7 +3,7 @@
void clang_analyzer_eval(int);
// rdar://problem/34831581: Used to crash.
// Used to crash.
void foo(void) {
char buf1[] = @encode(int **);
}

View File

@@ -24,7 +24,6 @@ typedef unsigned int NSUInteger;
@implementation Test
// <rdar://problem/6946338> for subscripting
- (id)storeDoesNotRetain {
Test *cell = [[[Test alloc] init] autorelease];
@@ -36,7 +35,6 @@ typedef unsigned int NSUInteger;
return cell;
}
// <rdar://problem/8824416> for subscripting
- (id)getDoesNotRetain:(BOOL)keyed {
if (keyed)
return [self[self] autorelease]; // expected-warning{{Object autoreleased too many times}}
@@ -44,7 +42,6 @@ typedef unsigned int NSUInteger;
return [self[0] autorelease]; // expected-warning{{Object autoreleased too many times}}
}
// <rdar://problem/9241180> for subscripting
- (id)testUninitializedObject:(BOOL)keyed {
Test *o;
if (keyed) {

View File

@@ -619,7 +619,6 @@ unsigned int no_warning_on_getter(ArrayOwner *owner) {
unsigned int warn_on_overrelease(ArrayOwner *owner) {
// FIXME: summaries are not applied in case the source of the getter/setter
// is known.
// rdar://45681203
OSArray *arr = owner->getArray();
arr->release();
return arr->getCount();

View File

@@ -38,7 +38,7 @@ void test_null_field(void) {
*(x.p) = 0xDEADBEEF;
}
// <rdar://problem/8331641> leak reports should not show paths that end with exit() (but ones that don't end with exit())
// leak reports should not show paths that end with exit() (but ones that don't end with exit())
void panic(void) __attribute__((noreturn));
enum { kCFNumberSInt8Type = 1, kCFNumberSInt16Type = 2, kCFNumberSInt32Type = 3, kCFNumberSInt64Type = 4, kCFNumberFloat32Type = 5, kCFNumberFloat64Type = 6, kCFNumberCharType = 7, kCFNumberShortType = 8, kCFNumberIntType = 9, kCFNumberLongType = 10, kCFNumberLongLongType = 11, kCFNumberFloatType = 12, kCFNumberDoubleType = 13, kCFNumberCFIndexType = 14, kCFNumberNSIntegerType = 15, kCFNumberCGFloatType = 16, kCFNumberMaxType = 16 };
typedef const struct __CFAllocator * CFAllocatorRef;

View File

@@ -59,7 +59,6 @@ int test_cond_assign(void) {
}
// The following previously crashed when generating extensive diagnostics.
// <rdar://problem/10797980>
@interface RDar10797980_help
@property (readonly) int x;
@end
@@ -80,7 +79,7 @@ int test_cond_assign(void) {
// The original source for the above Radar contains another problem:
// if the end-of-path node is an implicit statement, it may not have a valid
// source location. <rdar://problem/12446776>
// source location.
- (void)test2 {
if (bar_cond_assign()) {
id foo = [[RDar10797980 alloc] init]; // leak

View File

@@ -37,8 +37,6 @@ typedef struct _NSZone NSZone;
-(id)initWithInteger:(int)i;
@end
// rdar://6946338
@interface Test1 : NSObject {
NSString *text;
}
@@ -65,8 +63,6 @@ typedef struct _NSZone NSZone;
@end
// rdar://8824416
@interface MyNumber : NSObject
{
NSNumber* _myNumber;
@@ -130,8 +126,6 @@ NSNumber* numberFromMyNumberProperty(MyNumber* aMyNumber)
#endif
// rdar://6611873
@interface Person : NSObject {
NSString *_name;
}
@@ -174,7 +168,7 @@ void rdar6611873(void) {
#if !__has_feature(objc_arc)
// <rdar://problem/9241180> Static analyzer doesn't detect uninitialized variable issues for property accesses
// Static analyzer doesn't detect uninitialized variable issues for property accesses
@interface RDar9241180
@property (readwrite,assign) id x;
-(id)testAnalyzer1:(int) y;
@@ -252,7 +246,6 @@ void testConsistencyAssign(Person *p) {
// Tests for the analyzer fix that works around a Sema bug
// where multiple methods are created for properties in class extensions that
// are redeclared in a category method.
// The Sema bug is tracked as <rdar://problem/25481164>.
@interface ClassWithRedeclaredPropertyInExtensionFollowedByCategory
@end
@@ -537,7 +530,6 @@ void testOverrelease(Person *p, int coin) {
}
}
// <rdar://problem/16333368>
@implementation Person (Rdar16333368)
- (void)testDeliberateRelease:(Person *)other {
@@ -965,7 +957,6 @@ void testOpaqueConsistency(OpaqueIntWrapper *w) {
[_implicitSynthProp release]; // FIXME: no-warning{{not owned}}
}
// rdar://problem/19862648
- (void)establishIvarIsNilDuringLoops {
extern id getRandomObject(void);
@@ -980,7 +971,6 @@ void testOpaqueConsistency(OpaqueIntWrapper *w) {
}
}
// rdar://problem/20335433
- (void)retainIvarAndInvalidateSelf {
extern void invalidate(id);
[_unownedProp retain];

View File

@@ -87,7 +87,6 @@ void testConsistencyCustomCopy(CustomCopyWrapper *w) {
@synthesize inner;
@end
// rdar://67416721
void testNoDirectPropertyDecl(NoDirectPropertyDecl *w) {
clang_analyzer_eval(w.inner.value == w.inner.value); // expected-warning{{TRUE}}

View File

@@ -59,7 +59,7 @@ char t6 (char* p) {
}
// PR13440 / <rdar://problem/11977113>
// PR13440
// Test that the array-to-pointer decay works for array references as well.
// More generally, when we want an lvalue for a reference field, we still need
// to do one level of load.

View File

@@ -485,7 +485,6 @@ id returnInputParam(id x) {
}
@end
// Original problem: rdar://problem/50739539
@interface MyClassThatLeaksDuringInit : NSObject
+ (MyClassThatLeaksDuringInit *)getAnInstance1;

View File

@@ -135,10 +135,10 @@ CFAbsoluteTime f4(void) {
}
@end
//===------------------------------------------------------------------------------------------===//
// <rdar://problem/7257223> (also <rdar://problem/7283470>) - False positive due to not invalidating
// the reference count of a tracked region that was itself invalidated.
//===------------------------------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// False positive due to not invalidating the reference count of a tracked
// region that was itself invalidated.
//===----------------------------------------------------------------------===//
typedef struct __rdar_7257223 { CFDateRef x; } RDar7257223;
void rdar_7257223_aux(RDar7257223 *p);
@@ -229,7 +229,7 @@ void pr6699(int x) {
}
}
// <rdar://problem/8261992> Idempotent operation checker false positive with ObjC ivars
// Idempotent operation checker false positive with ObjC ivars
@interface R8261992 : NSObject {
@package int myIvar;
}

View File

@@ -713,7 +713,6 @@ void f18(__attribute__((annotate("rc_ownership_consumed"))) isl_basic_map *bmap)
}
@end
// <rdar://problem/6659160>
int isFoo(char c);
static void rdar_6659160(char *inkind, char *inname)
@@ -787,10 +786,10 @@ void pr3820_DeallocAfterRelease(void)
// message sent to released object
}
// From <rdar://problem/6704930>. The problem here is that 'length' binds to
// '($0 - 1)' after '--length', but SimpleConstraintManager doesn't know how to
// reason about '($0 - 1) > constant'. As a temporary hack, we drop the value
// of '($0 - 1)' and conjure a new symbol.
// The problem here is that 'length' binds to'($0 - 1)' after '--length', but
// SimpleConstraintManager doesn't know how to reason about
// '($0 - 1) > constant'. As a temporary hack, we drop the value of '($0 - 1)'
// and conjure a new symbol.
void rdar6704930(unsigned char *s, unsigned int length) {
NSString* name = 0;
if (s != 0) {
@@ -821,7 +820,6 @@ void rdar6704930(unsigned char *s, unsigned int length) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6833332>
// One build of the analyzer accidentally stopped tracking the allocated
// object after the 'retain'.
//===----------------------------------------------------------------------===//
@@ -854,9 +852,8 @@ void rdar6704930(unsigned char *s, unsigned int length) {
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6257780> clang checker fails to catch use-after-release
// clang checker fails to catch use-after-release
//===----------------------------------------------------------------------===//
int rdar_6257780_Case1(void) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSArray *array = [NSArray array];
@@ -866,18 +863,16 @@ int rdar_6257780_Case1(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/10640253> Analyzer is confused about NSAutoreleasePool -allocWithZone:.
// Analyzer is confused about NSAutoreleasePool -allocWithZone:.
//===----------------------------------------------------------------------===//
void rdar_10640253_autorelease_allocWithZone(void) {
NSAutoreleasePool *pool = [[NSAutoreleasePool allocWithZone:(NSZone*)0] init];
(void) pool;
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6866843> Checker should understand new/setObject:/release constructs
// Checker should understand new/setObject:/release constructs
//===----------------------------------------------------------------------===//
void rdar_6866843(void) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init];
@@ -893,7 +888,7 @@ void rdar_6866843(void) {
//===----------------------------------------------------------------------===//
// <rdar://problem/6877235> Classes typedef-ed to CF objects should get the same treatment as CF objects
// Classes typedef-ed to CF objects should get the same treatment as CF objects
//===----------------------------------------------------------------------===//
typedef CFTypeRef OtherRef;
@@ -913,10 +908,8 @@ typedef CFTypeRef OtherRef;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6320065> false positive - init method returns an object
// owned by caller
// False positive - init method returns an object owned by caller.
//===----------------------------------------------------------------------===//
@interface RDar6320065 : NSObject {
NSString *_foo;
}
@@ -957,10 +950,8 @@ int RDar6320065_test(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7129086> -awakeAfterUsingCoder: returns an owned object
// and claims the receiver
// -awakeAfterUsingCoder: returns an owned object and claims the receiver
//===----------------------------------------------------------------------===//
@interface RDar7129086 : NSObject {} @end
@implementation RDar7129086
- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder {
@@ -970,10 +961,8 @@ int RDar6320065_test(void) {
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6859457> [NSData dataWithBytesNoCopy] does not return a
// retained object
// [NSData dataWithBytesNoCopy] does not return a retained object
//===----------------------------------------------------------------------===//
@interface RDar6859457 : NSObject {}
- (NSString*) NoCopyString;
- (NSString*) noCopyString;
@@ -1025,8 +1014,7 @@ static void PR4230_new(void)
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6893565> don't flag leaks for return types that cannot be
// determined to be CF types
// Don't flag leaks for return types that cannot be determined to be CF types.
//===----------------------------------------------------------------------===//
// We don't know if 'struct s6893565' represents a Core Foundation type, so
@@ -1044,9 +1032,8 @@ typedef struct s6893565* TD6893565;
@end
//===----------------------------------------------------------------------===//
// <rdar://problem/6902710> clang: false positives w/QC and CoreImage methods
// clang: false positives w/QC and CoreImage methods
//===----------------------------------------------------------------------===//
void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context,
NSString *str, CIImage *img, CGRect rect,
CIFormat form, CGColorSpaceRef cs) {
@@ -1057,19 +1044,15 @@ void rdar6902710(QCView *view, QCRenderer *renderer, CIContext *context,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6945561> -[CIContext createCGLayerWithSize:info:]
// misinterpreted by clang scan-build
// -[CIContext createCGLayerWithSize:info:] misinterpreted by clang scan-build
//===----------------------------------------------------------------------===//
void rdar6945561(CIContext *context, CGSize size, CFDictionaryRef d) {
[context createCGLayerWithSize:size info:d]; // expected-warning{{leak}}
}
//===----------------------------------------------------------------------===//
// <rdar://problem/6961230> add knowledge of IOKit functions to retain/release
// checker
// Add knowledge of IOKit functions to retain/release checker.
//===----------------------------------------------------------------------===//
void IOBSDNameMatching_wrapper(mach_port_t mainPort, uint32_t options, const char * bsdName) {
IOBSDNameMatching(mainPort, options, bsdName); // expected-warning{{leak}}
}
@@ -1128,7 +1111,6 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort,
void CFDictionaryAddValue(CFMutableDictionaryRef, void *, void *);
// <rdar://problem/6539791>
void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
CFMutableDictionaryRef x = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFDictionaryAddValue(y, key, x);
@@ -1142,7 +1124,6 @@ void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
}
}
// <rdar://problem/6560661>
// Same issue, except with "AppendValue" functions.
void rdar_6560661(CFMutableArrayRef x) {
signed z = 1;
@@ -1154,7 +1135,6 @@ void rdar_6560661(CFMutableArrayRef x) {
CFRelease(value); // no-warning
}
// <rdar://problem/7152619>
// Same issue, excwept with "CFAttributeStringSetAttribute".
void rdar_7152619(CFStringRef str) {
CFAttributedStringRef string = CFAttributedStringCreate(kCFAllocatorDefault, str, 0);
@@ -1214,14 +1194,12 @@ void rdar_7184450_pos(CGContextRef myContext, CGFloat x, CGPoint myStartPoint,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7299394> clang false positive: retained instance passed to
// thread in pthread_create marked as leak
// clang false positive: retained instance passed to thread in pthread_create
// marked as leak.
//
// Until we have full IPA, the analyzer should stop tracking the reference
// count of objects passed to pthread_create.
//
//===----------------------------------------------------------------------===//
struct _opaque_pthread_t {};
struct _opaque_pthread_attr_t {};
typedef struct _opaque_pthread_t *__darwin_pthread_t;
@@ -1249,18 +1227,15 @@ void rdar_7299394_positive(pthread_attr_t *attr, pthread_t *thread) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/11282706> false positive with not understanding thread
// local storage
// False positive with not understanding thread local storage.
//===----------------------------------------------------------------------===//
void rdar11282706(pthread_key_t key) {
NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning
pthread_setspecific(key, (void*) number);
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7283567> False leak associated with call to
// CVPixelBufferCreateWithBytes ()
// False leak associated with call to CVPixelBufferCreateWithBytes()
//
// According to the Core Video Reference (ADC), CVPixelBufferCreateWithBytes and
// CVPixelBufferCreateWithPlanarBytes can release (via a callback) the
@@ -1268,7 +1243,6 @@ void rdar11282706(pthread_key_t key) {
// the reference count for the objects passed for this argument. This
// could be made smarter.
//===----------------------------------------------------------------------===//
typedef int int32_t;
typedef UInt32 FourCharCode;
typedef FourCharCode OSType;
@@ -1461,8 +1435,7 @@ OSStatus test_VTCompressionSessionCreateAndEncode_CallbackReleases(
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7358899> False leak associated with
// CGBitmapContextCreateWithData
// False leak associated with CGBitmapContextCreateWithData.
//===----------------------------------------------------------------------===//
typedef uint32_t CGBitmapInfo;
typedef void (*CGBitmapContextReleaseDataCallback)(void *releaseInfo, void *data);
@@ -1487,14 +1460,13 @@ void rdar_7358899(void *data,
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7265711> allow 'new', 'copy', 'alloc', 'init' prefix to
// start before '_' when determining Cocoa fundamental rule
// Allow 'new', 'copy', 'alloc', 'init' prefix to start before '_' when
// determining Cocoa fundamental rule.
//
// Previously the retain/release checker just skipped prefixes before the
// first '_' entirely. Now the checker honors the prefix if it results in a
// recognizable naming convention (e.g., 'new', 'init').
//===----------------------------------------------------------------------===//
@interface RDar7265711 {}
- (id) new_stuff;
@end
@@ -1509,10 +1481,8 @@ void rdar7265711_b(RDar7265711 *x) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7306898> clang thinks [NSCursor dragCopyCursor] returns a
// retained reference
// clang thinks [NSCursor dragCopyCursor] returns a retained reference.
//===----------------------------------------------------------------------===//
@interface NSCursor : NSObject
+ (NSCursor *)dragCopyCursor;
@end
@@ -1525,10 +1495,9 @@ void rdar7306898(void) {
}
//===----------------------------------------------------------------------===//
// <rdar://problem/7252064> sending 'release', 'retain', etc. to a Class
// directly is not likely what the user intended
// Sending 'release', 'retain', etc. to a Class directly is not likely what the
// user intended.
//===----------------------------------------------------------------------===//
@interface RDar7252064 : NSObject @end
void rdar7252064(void) {
[RDar7252064 release]; // expected-warning{{The 'release' message should be sent to instances of class 'RDar7252064' and not the class directly}}
@@ -1669,10 +1638,9 @@ CFDateRef returnsRetainedCFDate(void) {
//===----------------------------------------------------------------------===//
// Test that leaks post-dominated by "panic" functions are not reported.
//
// <rdar://problem/5905851> do not report a leak when post-dominated by a call
// to a noreturn or panic function
// Do not report a leak when post-dominated by a call to a noreturn or panic
// function.
//===----------------------------------------------------------------------===//
void panic(void) __attribute__((noreturn));
void panic_not_in_hardcoded_list(void) __attribute__((noreturn));
@@ -1700,9 +1668,9 @@ void test_panic_pos_2(int x) {
if (x)
panic();
if (!x) {
// This showed up in <rdar://problem/7796563>, where we silently missed checking
// the function type for noreturn. "panic()" is a hard-coded known panic function
// that isn't always noreturn.
// This showed up previously where we silently missed checking the function
// type for noreturn. "panic()" is a hard-coded known panic function that
// isn't always noreturn.
panic_not_in_hardcoded_list();
}
}
@@ -1749,17 +1717,14 @@ void test_blocks_1_indirect_retain_via_call(void) {
}
@end
// <rdar://problem/8272168> - Correcly handle Class<...> in Cocoa Conventions
// detector.
// Correcly handle Class<...> in Cocoa Conventions detector.
@protocol Prot_R8272168 @end
Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(void);
void r8272168(void) {
GetAClassThatImplementsProt_R8272168();
}
// Test case for <rdar://problem/8356342>, which in the past triggered
// a false positive.
// This used to trigger a false positive.
@interface RDar8356342
- (NSDate*) rdar8356342:(NSDate *)inValue;
@end
@@ -1777,8 +1742,7 @@ void r8272168(void) {
}
@end
// <rdar://problem/8724287> - This test case previously crashed because
// of a bug in BugReporter.
// This test case previously crashed because of a bug in BugReporter.
extern const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key);
typedef struct __CFError * CFErrorRef;
extern const CFStringRef kCFErrorUnderlyingErrorKey;
@@ -1800,16 +1764,15 @@ static void rdar_8724287(CFErrorRef error)
}
}
// <rdar://problem/9234108> - Make sure the model applies cf_consumed
// correctly in argument positions besides the first.
// Make sure the model applies cf_consumed correctly in argument positions
// besides the first.
extern void *CFStringCreate(void);
extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value);
void rdar_9234108(void) {
rdar_9234108_helper(0, CFStringCreate());
}
// <rdar://problem/9726279> - Make sure that objc_method_family works
// to override naming conventions.
// Make sure that objc_method_family works to override naming conventions.
struct TwoDoubles {
double one;
double two;
@@ -1833,7 +1796,6 @@ void rdar9726279(void) {
[value release];
}
// <rdar://problem/9732321>
// Test camelcase support for CF conventions. While Core Foundation APIs
// don't use camel casing, other code is allowed to use it.
CFArrayRef camelcase_create_1(void) {
@@ -1885,7 +1847,6 @@ CFArrayRef camel_copymachine(void) {
return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}}
}
// rdar://problem/8024350
@protocol F18P
- (id) clone; // expected-note 2 {{method declared here}}
@end
@@ -1900,7 +1861,6 @@ CFArrayRef camel_copymachine(void) {
}
@end
// Radar 6582778.
void rdar6582778(void) {
CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
CFTypeRef vals[] = { CFDateCreate(0, t) }; // expected-warning {{leak}}
@@ -1913,9 +1873,7 @@ void rdar6582778_2(void) {
global = CFDateCreate(0, t); // no-warning
}
// <rdar://problem/10232019> - Test that objects passed to containers
// are marked "escaped".
// Test that objects passed to containers are marked "escaped".
void rdar10232019(void) {
NSMutableArray *array = [NSMutableArray array];
@@ -1938,7 +1896,6 @@ void rdar10232019_positive(void) {
}
// RetainCountChecker support for XPC.
// <rdar://problem/9658496>
typedef void * xpc_object_t;
xpc_object_t _CFXPCCreateXPCObjectFromCFObject(CFTypeRef cf);
void xpc_release(xpc_object_t object);
@@ -2324,9 +2281,8 @@ void autoreleaseObjC(void) {
} // expected-warning{{Object autoreleased too many times}}
//===----------------------------------------------------------------------===//
// <rdar://problem/13783514> xpc_connection_set_finalizer_f
// xpc_connection_set_finalizer_f
//===----------------------------------------------------------------------===//
typedef xpc_object_t xpc_connection_t;
typedef void (*xpc_finalizer_t)(void *value);
void xpc_connection_set_context(xpc_connection_t connection, void *ctx);

View File

@@ -461,7 +461,6 @@ void radar13722286::PrepareBitmap() {
}
}
// rdar://34210609
void _() { _(); }; // no-warning
// Do not assume that IOBSDNameMatching increments a reference counter,

View File

@@ -48,8 +48,7 @@
typedef typeof(sizeof(int)) size_t;
// <rdar://problem/6336718> rule request: floating point used as loop
// condition (FLP30-C, FLP-30-CPP)
// rule request: floating point used as loop condition (FLP30-C, FLP-30-CPP)
//
// For reference: https://www.securecoding.cert.org/confluence/display/seccode/FLP30-C.+Do+not+use+floating+point+variables+as+loop+counters
//
@@ -90,7 +89,7 @@ void test_bzero(void *a, size_t n) {
bzero(a, n); // expected-warning{{The bzero() function is obsoleted by memset()}}
}
// <rdar://problem/6335715> rule request: gets() buffer overflow
// rule request: gets() buffer overflow
// Part of recommendation: 300-BSI (buildsecurityin.us-cert.gov)
char* gets(char *buf);
@@ -106,8 +105,7 @@ void test_getpw(void) {
getpw(2, buff); // expected-warning{{The getpw() function is dangerous as it may overflow the provided buffer. It is obsoleted by getpwuid()}}
}
// <rdar://problem/6337132> CWE-273: Failure to Check Whether Privileges Were
// Dropped Successfully
// CWE-273: Failure to Check Whether Privileges Were Dropped Successfully
typedef unsigned int __uint32_t;
typedef __uint32_t __darwin_uid_t;
typedef __uint32_t __darwin_gid_t;
@@ -138,7 +136,7 @@ void test_setuid(void)
setregid(2,2); // expected-warning{{The return value from the call to 'setregid' is not checked. If an error occurs in 'setregid', the following code may execute with unexpected privileges}}
}
// <rdar://problem/6337100> CWE-338: Use of cryptographically weak prng
// CWE-338: Use of cryptographically weak prng
typedef unsigned short *ushort_ptr_t; // Test that sugar doesn't confuse the warning.
int rand(void);
double drand48(void);

View File

@@ -74,14 +74,12 @@ ComparatorBlock test_return_block_neg(void) {
return b; // no-warning
}
// <rdar://problem/7523821>
int *rdar_7523821_f2(void) {
int a[3];
return a; // expected-warning 2 {{ddress of stack memory associated with local variable 'a' returned}}
};
// Handle blocks that have no captures or are otherwise declared 'static'.
// <rdar://problem/10348049>
typedef int (^RDar10348049)(int value);
RDar10348049 test_rdar10348049(void) {
static RDar10348049 b = ^int(int x) {

View File

@@ -89,7 +89,6 @@ struct TS {
}
};
// rdar://11345441
int* f5() {
int& i = i; // expected-warning {{Assigned value is garbage or undefined}} expected-warning{{reference 'i' is not yet bound to a value when used within its own initialization}}
return &i;

View File

@@ -31,8 +31,6 @@ int main(){
m.I();
}
// <rdar://problem/11949235>
template<class T, unsigned N>
inline unsigned array_lengthof(T (&)[N]) {
return N;

Some files were not shown because too many files have changed in this diff Show More