LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 2593 - NSAssert/NSParameterAssert are not understood by the checker
Summary: NSAssert/NSParameterAssert are not understood by the checker
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: Static Analyzer (show other bugs)
Version: unspecified
Hardware: PC All
: P normal
Assignee: Ted Kremenek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-24 02:28 PDT by Quentin Carnicelli
Modified: 2018-11-07 00:22 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Quentin Carnicelli 2008-07-24 02:28:54 PDT
The following class generates a NullDereference warning:

@interface TestAssert : NSObject {
	
}

@end

@implementation TestAssert

- (id)initWithPointer: (int*)x
{
	NSParameterAssert( x != nil );
	NSAssert( x != nil, @"" );
	
	if( (self = [super init]) != nil )
	{
		*x = 1;
	}
	
	return self;
}

@end

Although the checker seems to understand assert(), both NSAssert() and NSParameterAssert() are ignored, causing false positives like the above. Maybe this falls under inter-procedure checking, but given that assert() fails to trigger the above warning, I'm suspecting it is it's own special case.
Comment 1 Ted Kremenek 2008-07-24 13:48:21 PDT
Fixed in r53993:

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080721/006665.html

Will be rolled into checker-69.