Commit Graph

23 Commits

Author SHA1 Message Date
Rafael Espindola ea1ba0adfc Replace -fobjc-default-synthesize-properties with disable-objc-default-synthesize-properties.
We want the modern behavior most of the time, so inverting the option simplifies
the driver and the tests.

llvm-svn: 191551
2013-09-27 20:21:48 +00:00
Anna Zaks 6bab4ef4e8 [analyzer] Replace "-analyzer-ipa" with "-analyzer-config ipa".
The idea is to eventually place all analyzer options under
"analyzer-config". In addition, this lays the ground for introduction of
a high-level analyzer mode option, which will influence the
default setting for IPAMode.

llvm-svn: 173385
2013-01-24 23:15:30 +00:00
Anna Zaks 3f12949b25 [analyzer] Fix a self-init checker false positive.
This is a Band-Aid fix to a false positive, where we complain about not
initializing self to [super init], where self is not coming from the
init method, but is coming from the caller to init.

The proper solution would be to associate the self and it's state with
the enclosing init.

llvm-svn: 170059
2012-12-13 00:42:19 +00:00
Anna Zaks 5808eb8029 [analyzer] Handle inlining of instance calls to super.
Use self-init.m for testing. (It used to have a bunch of failing tests
with dynamic inlining turned on.)

llvm-svn: 161012
2012-07-30 23:48:36 +00:00
Anna Zaks 66843480a6 [analyzer] SelfInit: Stop tracking self if it's assigned a value we
don't reason about.

Self is just like a local variable in init methods, so it can be
assigned anything like result of static functions, other methods ... So
to suppress false positives that result in such cases, stop tracking the
checker-specific state after self is being assigned to (unless the
value is't being assigned to is either self or conforms to our rules).

This change does not invalidate any existing regression tests.

llvm-svn: 156420
2012-05-08 21:19:21 +00:00
Chad Rosier 155005c071 Add atan, atan2, exp, and log to the builtin math library functions.
With -fno-math-errno (the default for Darwin) or -ffast-math these library 
function can be marked readnone enabling more opportunities for CSE and other
optimizations.
rdar://11251464

llvm-svn: 155498
2012-04-24 22:40:01 +00:00
Anna Zaks 51244c22be [analyzer] Fix a false alarm in SelfInitChecker (radar://11235991).
Along with it, fix a couple of other corner cases and add more tests.

llvm-svn: 154866
2012-04-16 21:51:09 +00:00
Anna Zaks 53a0b6c161 [analyzer] False positive in SelfInit - teach the checker about method
calls with self as a parameter.

llvm-svn: 152039
2012-03-05 18:58:25 +00:00
Anna Zaks 8e009df96e [analyzer] Turn on by default two checkers:
- osx.coreFoundation.containers.IndexOutOfBounds
 - osx.cocoa.SelfInit

llvm-svn: 149747
2012-02-04 02:31:57 +00:00
Anna Zaks 922b86e7e1 [analyzer] fixup to the previous commit.
llvm-svn: 149746
2012-02-04 02:31:53 +00:00
Anna Zaks 00790d9a3b [analyzer] Minor cleanups to the ObjCSelfInitChecker.
(Also renames in other ObjC checkers to create one category of checks.)

llvm-svn: 149745
2012-02-04 02:31:37 +00:00
Ted Kremenek 3f955e6d89 [analyzer] rename all experimental checker packages to have 'experimental' be the common root package.
llvm-svn: 136835
2011-08-03 23:14:55 +00:00
Ted Kremenek 8067746554 Move the SelfInit checker to the 'cocoa.experimental' package.
llvm-svn: 130598
2011-04-30 06:46:45 +00:00
Ted Kremenek 49c79790de Rework checker "packages" and groups to be more hierarchical.
llvm-svn: 128187
2011-03-24 00:28:47 +00:00
Argyrios Kyrtzidis 9eb02dfa89 [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer award.
llvm-svn: 126676
2011-02-28 19:49:42 +00:00
Argyrios Kyrtzidis 556c45e9c5 [analyzer] Overhauling of the checker registration mechanism.
-Checkers will be defined in the tablegen file 'Checkers.td'.
-Apart from checkers, we can define checker "packages" that will contain a collection of checkers.
-Checkers can be enabled with -analyzer-checker=<name> and disabled with -analyzer-disable-checker=<name> e.g:
	Enable checkers from 'cocoa' and 'corefoundation' packages except the self-initialization checker:
	-analyzer-checker=cocoa -analyzer-checker=corefoundation -analyzer-disable-checker=cocoa.SelfInit
-Introduces CheckerManager and CheckerProvider. CheckerProviders get the set of checker names to enable/disable and
 register them with the CheckerManager which will be the entry point for all checker-related functionality.

Currently only the self-initialization checker takes advantage of the new mechanism.

llvm-svn: 125503
2011-02-14 18:13:31 +00:00
Ted Kremenek 70aeefa17e Weaken the ObjCSelfInitChecker to only warn when one calls an 'init' method within an 'init' method. This is a temporary stop gap to avoid false positives while we investigate how to make it smarter.
llvm-svn: 125427
2011-02-12 03:03:54 +00:00
Argyrios Kyrtzidis dd03d8ddaa [analyzer] Fix a false positive of the 'self' initialization checker.
A common pattern in classes with multiple initializers is to put the
subclass's common initialization bits into a static function that receives
the value of 'self', e.g:

   if (!(self = [super init]))
     return nil;
   if (!(self = _commonInit(self)))
     return nil;

It was reported that 'self' was not set to the result of [super init].
Until we can use inter-procedural analysis, in such a call, transfer the
ObjCSelfInitChecker flags associated with 'self' to the result of the call.

Fixes rdar://8937441 & http://llvm.org/PR9094

llvm-svn: 124940
2011-02-05 05:54:53 +00:00
Argyrios Kyrtzidis 8b6ec6870f Warn for "if ((a == b))" where the equality expression is needlessly wrapped inside parentheses.
It's highly likely that the user intended an assignment used as condition.

Addresses rdar://8848646.

llvm-svn: 124668
2011-02-01 18:24:22 +00:00
Argyrios Kyrtzidis c7ffd35cb7 [analyzer] Enable the self-init checker under command-line option '-analyzer-check-objc-self-init' which by default
is enabled by the driver for '--analyze'.

llvm-svn: 124266
2011-01-26 01:26:50 +00:00
Argyrios Kyrtzidis 8781b7dded [analyzer] Improve the diagnostic for the self-init checker. Suggestion by Ted!
llvm-svn: 124263
2011-01-26 01:26:41 +00:00
Argyrios Kyrtzidis 3ae681eb12 [analyzer] Do the self-init check only on NSObject subclasses. Patch by Jean-Daniel Dupas!
llvm-svn: 124249
2011-01-25 23:54:44 +00:00
Argyrios Kyrtzidis 4b7433fab2 [analyzer] Introduce ObjCSelfInitChecker, which checks initialization methods to verify that they assign 'self' to the
result of an initialization call (e.g. [super init], or [self initWith..]) before using any instance variable or
returning 'self'.

llvm-svn: 123264
2011-01-11 19:45:25 +00:00