Anna Zaks
8dc53af5dc
[analyzer] Fix a regression introduced in malloc with
...
attributes, introduced in r151188.
+ the test to catch it.
Thanks to Ahmed Charles for pointing this out.
llvm-svn: 151840
2012-03-01 22:06:06 +00:00
Eric Christopher
4b6753cf10
Reapply r151702 with a small fix for a failure to cut and paste
...
correctly.
Still rdar://10900684
llvm-svn: 151838
2012-03-01 21:36:52 +00:00
Eli Friedman
23b1be991e
Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.
...
llvm-svn: 151837
2012-03-01 21:32:56 +00:00
Argyrios Kyrtzidis
888d4a62fa
Remove test/Sema/many-logical-ops.c since it fails in linux variants.
...
Will bring it up once the issue is fixed properely.
llvm-svn: 151830
2012-03-01 19:47:26 +00:00
Jean-Daniel Dupas
7598fadd78
Merge __has_attribute tests. Patch by Jonathan Sauer!
...
llvm-svn: 151819
2012-03-01 17:45:53 +00:00
Peter Collingbourne
cdb9f302d0
StmtProfiler: Add a null check for child statements.
...
llvm-svn: 151812
2012-03-01 16:34:31 +00:00
Jean-Daniel Dupas
908f130d58
Implement double underscore names support in __has_attribute
...
llvm-svn: 151809
2012-03-01 14:53:16 +00:00
Richard Smith
ead9a05596
Revert r151800, which was committed without review and has correctness issues.
...
llvm-svn: 151804
2012-03-01 06:49:39 +00:00
Aaron Ballman
cd5092dfba
Implements support for #pragma include_alias in ms compatibility mode. Fixes PR10705.
...
llvm-svn: 151800
2012-03-01 04:18:49 +00:00
Aaron Ballman
9ecff02a45
Added support for parsing declspecs on enumerations. Fixes PR8783
...
llvm-svn: 151798
2012-03-01 04:09:28 +00:00
Eli Friedman
98b01edc8c
Implement "optimization" for lambda-to-block conversion which inlines the generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap.
...
Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed.
llvm-svn: 151797
2012-03-01 04:01:32 +00:00
Richard Smith
5e0cac784a
Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. Also
...
improve the diagnostics for some attempts to use initializer lists in
expressions.
llvm-svn: 151794
2012-03-01 02:59:17 +00:00
Ted Kremenek
05e916bc95
Fix regression from llvm-gcc where we should NOT emit a warning about __attribute__((NSObject)) on a property declaration. This is needed to have retain properties for non-object pointers. Fixes <rdar://problem/10930507>.
...
llvm-svn: 151786
2012-03-01 01:40:32 +00:00
Nico Weber
2c21c449d9
Move suport for redefining operator keywords from -fms-extensions to -fms-compatibility.
...
llvm-svn: 151776
2012-03-01 00:13:46 +00:00
Nico Weber
2e686205e8
Allow operator keywords to be #defined in ms-ext mode.
...
Fixes PR10606.
I'm not sure if this is the best way to go about it, but
I locally enabled this code path without the msext conditional,
and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp
which explicitly checks that operator keywords can't be redefined.
I also parsed chromium/win with a clang with and without this patch.
It introduced no new errors, but removes 43 existing errors.
llvm-svn: 151768
2012-02-29 22:54:43 +00:00
Fariborz Jahanian
203ea38085
Test for my last patch. // rdar://10267155.
...
llvm-svn: 151767
2012-02-29 22:21:36 +00:00
Fariborz Jahanian
86c2f5cc70
objective-c: provide fixit hint when atomic property does not
...
have matching user defined setter/getter and a warning is issued.
In this case, a fixit note is displayed. // rdar://10267155
llvm-svn: 151766
2012-02-29 22:18:55 +00:00
Chad Rosier
ff3f99bf0a
I referenced the incorrect rdar in my previous commit (r151745). Add the
...
correct radar number to the test case for tracking purposes.
rdar://10551066
llvm-svn: 151746
2012-02-29 20:18:57 +00:00
Chad Rosier
b1cfc6864f
Allocate TargetLibraryInfo for the CodeGen passes. Otherwise, it's instantiated
...
by the BAA pass, which uses the default TargetLibraryInfo constructor.
Unfortunately, the default TargetLibraryInfo constructor assumes all library
calls are available and thus ignores -fno-builtin.
rdar://10947759
llvm-svn: 151745
2012-02-29 20:14:59 +00:00
Anna Zaks
e0c03cab58
[analyzer] Malloc: A pointer might escape through CFContainers APIs,
...
funopen, setvbuf.
Teach the checker and the engine about these APIs to resolve malloc
false positives. As I am adding more of these APIs, it is clear that all
this should be factored out into a separate callback (for example,
region escapes). Malloc, KeyChainAPI and RetainRelease checkers could
all use it.
llvm-svn: 151737
2012-02-29 18:42:47 +00:00
Daniel Dunbar
c2f9dc91c1
Revert r151702, "Add support for handling captured variables in lambda debug
...
info.", which broke some -O0 -g tests.
llvm-svn: 151730
2012-02-29 16:28:29 +00:00
Sebastian Redl
c7b718eb53
Tentatively fix PR12117. The test case from the bug now passes, and all existing tests still pass, but there may still be corner cases.
...
llvm-svn: 151716
2012-02-29 12:47:43 +00:00
James Molloy
6f8780bed1
Reapply r151638 and r151641.
...
The bug that was caught by Apple's internal buildbots was valid and also showed another bug in my implementation.
These are now fixed, with regression tests added to catch them both (not Darwin-specific).
Original log:
====================
Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:
enum e {x, y};
int f(enum {y, x} n) {
return 0;
}
This finally fixes PR5464 and PR5477.
---------------------
I also reverted r151641 which was enhancement on top of r151638.
====================
llvm-svn: 151712
2012-02-29 10:24:19 +00:00
Erik Verbruggen
64aea6524d
Remove a recursive visitiation in ExprEngine that is no longer needed
...
because the CFG is fully linearized.
llvm-svn: 151711
2012-02-29 08:42:57 +00:00
Ted Kremenek
ef5c554df4
[analyzer] Tweak the UnreachableCode checker to not warning about unreachable default blocks. Patch by Cyril Roelandt!
...
llvm-svn: 151709
2012-02-29 06:05:28 +00:00
Eli Friedman
e4f22dfa95
A couple minor bug-fixes for template instantiation for expressions which are sometimes potentially evaluated.
...
llvm-svn: 151707
2012-02-29 04:03:55 +00:00
Argyrios Kyrtzidis
3dbeb55874
[driver] Emit an error when trying to use ARC on macosx earlier than 10.6
...
rdar://10459258
llvm-svn: 151706
2012-02-29 03:43:52 +00:00
Eric Christopher
3203f6b9da
Add support for handling captured variables in lambda debug info.
...
This currently doesn't handle capturing the 'this' pointer for any
enclosing class.
Steal the lambda-expressions.cpp testcase and debugify it and try
to use more variables to proof it against random changes.
Part of rdar://10900684
llvm-svn: 151702
2012-02-29 03:25:30 +00:00
Eli Friedman
c6237c6e05
Make the odr-use logic work correctly for constant-expressions. PR12006.
...
llvm-svn: 151699
2012-02-29 03:16:56 +00:00
NAKAMURA Takumi
10cea170d2
clang/test/Analysis/stats.c: Fix up r151656.
...
llvm-svn: 151695
2012-02-29 02:04:39 +00:00
NAKAMURA Takumi
f1801d65e7
clang/test/Analysis/stats.c: Mark this as XFAIL: mingw32.
...
FIXME: Could we guarantee not to get stack overflow also on mingw?
llvm-svn: 151692
2012-02-29 01:50:38 +00:00
Eli Friedman
576cbd03b4
Make sure list-initialization of arrays works correctly in explicit type conversions. PR12121.
...
llvm-svn: 151674
2012-02-29 00:00:28 +00:00
Argyrios Kyrtzidis
fcbfdee5df
[libclang] Add a test I forgot to commit.
...
llvm-svn: 151669
2012-02-28 23:39:24 +00:00
Argyrios Kyrtzidis
5cb4760aed
[PCH] Include a darwin-only PCH test on Cocoa.h.
...
llvm-svn: 151668
2012-02-28 23:39:20 +00:00
Argyrios Kyrtzidis
5929ef2ee7
Revert r151638 because it causes assertion hit on PCH creation for Cocoa.h
...
Original log:
---------------------
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:
enum e {x, y};
int f(enum {y, x} n) {
return 0;
}
This finally fixes PR5464 and PR5477.
---------------------
I also reverted r151641 which was enhancement on top of r151638.
llvm-svn: 151667
2012-02-28 23:39:14 +00:00
Sebastian Redl
12edeb0899
Single- and zero-element initializer lists to scalars are list-initializations. Fixes PR12118.
...
llvm-svn: 151666
2012-02-28 23:36:38 +00:00
Fariborz Jahanian
265a421dd9
Modern objective-c translator. rewriting ivars of aggregate type.
...
llvm-svn: 151662
2012-02-28 22:45:07 +00:00
Anna Zaks
75de32322a
[analyzer] Leaks should be uniqued by the allocation point in the
...
closest function context (RetainCountChecker).
llvm-svn: 151661
2012-02-28 22:39:22 +00:00
Anna Zaks
16f3831064
[analyzer] Retain release: drop the line number info from the leak
...
message.
llvm-svn: 151657
2012-02-28 21:49:08 +00:00
Anna Zaks
b6e2854f68
[analyzer] Stats: Add the stats about remove dead bindings, correct the
...
test.
llvm-svn: 151656
2012-02-28 21:49:04 +00:00
Chad Rosier
2ad368fce3
[driver] Add support for -g2 and -ggdb debug flags.
...
rdar://10947759
llvm-svn: 151654
2012-02-28 20:49:04 +00:00
James Molloy
051390fffa
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
...
This fixes code such as:
enum e {x, y};
int f(enum {y, x} n) {
return 0;
}
This finally fixes PR5464 and PR5477.
llvm-svn: 151638
2012-02-28 18:12:11 +00:00
Eli Friedman
7dff8a68df
Basic coverage test for conversion-to-block-pointer for lambda expressions.
...
llvm-svn: 151616
2012-02-28 03:32:48 +00:00
Anna Zaks
6ca4fd5b88
[analyzer] Leaks should be uniqued by the allocation point in the
...
closest function context (Keychain API).
llvm-svn: 151613
2012-02-28 03:07:06 +00:00
Anna Zaks
06a77fc1b9
[analyzer] Fix Malloc False Positive (PR 12100)
...
When allocated buffer is passed to CF/NS..NoCopy functions, the
ownership is transfered unless the deallocator argument is set to
'kCFAllocatorNull'.
llvm-svn: 151608
2012-02-28 01:54:22 +00:00
Ted Kremenek
3bc5372fae
[analyzer] teach analyzer about ObjC literals, thus trimming out a false positive with the malloc() checker involving
...
comparing literal addresses to nil.
Fixes <rdar://problem/10579586>
llvm-svn: 151602
2012-02-28 00:56:05 +00:00
Anna Zaks
43ffba2676
[analyzer] Leaks should be uniqued by the allocation point in the
...
closest function context.
This prevents us from uniqueing all leaks from the same allocation
helper. radar://10932226
llvm-svn: 151592
2012-02-27 23:40:55 +00:00
Richard Trieu
9cd797aa3e
Fix a test case that was added in r151570. The redirect of output was broken
...
so no testing was actually done. Further, the commands produce no output.
The redirection has been fixed and the test has been disabled.
llvm-svn: 151591
2012-02-27 23:40:41 +00:00
Sebastian Redl
a235e2d8ad
Hack in a loud error for PR12086. Better than a silent miscompile.
...
llvm-svn: 151586
2012-02-27 23:20:01 +00:00
Argyrios Kyrtzidis
465e137558
When evaluating integer expressions include a check for sub-expressions
...
depth and error if we exceed a max value, to make sure we avoid a stack overflow.
This is a hacky temporary fix. rdar://10913206.
llvm-svn: 151585
2012-02-27 23:18:37 +00:00