Commit Graph

13794 Commits

Author SHA1 Message Date
Anna Zaks 265087721a [analyzer] Bound the size of the functions being inlined + provide
command line options for inlining tuning.

This adds the option for stack depth bound as well as function size
bound. 

+ minor doxygenification

llvm-svn: 151930
2012-03-02 19:05:03 +00:00
Fariborz Jahanian bf48281c25 Change diagnostic test for my last patch.
// rdar://10961370

llvm-svn: 151923
2012-03-02 17:05:03 +00:00
Daniel Dunbar d01281fe0d Revert r151879, r151880, "PR12145: Avoid emitting loads of constexpr variables in contexts where there" and "Fix buildbot: make this test less dependent on the value names in the produced IR."
They broke bootstrap.

llvm-svn: 151922
2012-03-02 16:24:25 +00:00
Richard Smith 35ecb36fcd Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.

llvm-svn: 151881
2012-03-02 04:14:40 +00:00
Richard Smith 545f38c3d2 Fix buildbot: make this test less dependent on the value names in the produced IR.
llvm-svn: 151880
2012-03-02 03:22:38 +00:00
Richard Smith a541a3bbee PR12145: Avoid emitting loads of constexpr variables in contexts where there
is no odr-use of the variable. Go slightly beyond what the standard requires
for variables of reference type.

llvm-svn: 151879
2012-03-02 03:16:32 +00:00
Ted Kremenek f9e9d33019 [analyzer diagnostics] Change CompactPathDiagnostic to recursively compact diagnostics in calls into macro pieces.
Also fix handling of macros within calls in the HTMLDiagnostics.

This also adds a test case for r151774.

llvm-svn: 151872
2012-03-02 01:27:31 +00:00
Fariborz Jahanian 3854a55a17 c/objc: problem originally reported as an objective-c bug.
But it is in the underlying c part of clang. clang crashes
in IRGen when passing an incomplete type argument to 
variadic function (instead of diagnosing the bug).
// rdar://10961370

llvm-svn: 151862
2012-03-01 23:42:00 +00:00
Eli Friedman c4e5d0ccda Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name says.
llvm-svn: 151853
2012-03-01 22:52:28 +00:00
Eric Christopher 5bc1f47b00 Update test for llvm assembly output change. Also add a fixme that this
shouldn't be relying on assembly emission.

For the record we should check the metadata output from the front
end and then check in the backend that such a thing emits a pubtypes
entry.

llvm-svn: 151851
2012-03-01 22:49:10 +00:00
Anna Zaks d5c3027473 [analyzer] Turn inlining on by default for better testing exposure.
Fix a test, which was most likely an unintended recursive call.

llvm-svn: 151848
2012-03-01 22:37:46 +00:00
Kostya Serebryany 28a7a1198b Add a flag -fthread-sanitizer.
This flag enables ThreadSanitizer instrumentation committed to llvm as r150423.
The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer.
This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet
committed and it's structure in compiler-rt is not 100% clear.
The users manual wil be changed in a separate commit.

llvm-svn: 151846
2012-03-01 22:27:08 +00:00
Ted Kremenek c1e4dd0e8e Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

llvm-svn: 151841
2012-03-01 22:07:04 +00:00
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