Ted Kremenek [Tue, 28 Feb 2012 00:56:05 +0000 (00:56 +0000)]
[analyzer] teach analyzer about ObjC literals, thus trimming out a false positive with the malloc() checker involving
comparing literal addresses to nil.
Richard Trieu [Mon, 27 Feb 2012 23:40:41 +0000 (23:40 +0000)]
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.
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.
Ted Kremenek [Mon, 27 Feb 2012 22:55:11 +0000 (22:55 +0000)]
After numerous requests, have Objective-C 'method declared here' notes mention the actual method. This looks better within an IDE, where text isn't always regurgitated in the presentation of a warning. Fixes radar 10914035.
Eli Friedman [Mon, 27 Feb 2012 21:21:40 +0000 (21:21 +0000)]
Fix a couple bugs in the way we handle array indexes in array bounds checking. Specifically, make sure we don't ignore explicit casts in indexes, and make sure we use unsigned extension/comparisons on indexes. Fixes <rdar://problem/10916006>.
Richard Smith [Mon, 27 Feb 2012 06:07:25 +0000 (06:07 +0000)]
Ensure that we delete default constructors in the right cases. Don't delete the
default constructor of a union if it has a const member with no user-provided
default constructor.
Richard Smith [Sun, 26 Feb 2012 23:40:27 +0000 (23:40 +0000)]
Half of PR12088: parse braced-init-lists on the RHS of assignment operators.
If the assignment operator is a scalar type, we continue to incorrectly reject
the initializer, but semantic analysis (and codegen) is correct for overloaded
operators.
Chandler Carruth [Sun, 26 Feb 2012 09:21:43 +0000 (09:21 +0000)]
A follow-up to r151482 which added support for powerpc and powerpc64
Debian multiarch libraries, this should in theory add support for those
platform's header search rules. I don't have a system to check this
with, so review appreciated. I've added the corresponding tests
referring to the debian multiarch tree.
We are starting to have a relatively completely tested Linux platform
for header search and library search, with several interesting
peculiarities. We should point people at the debian_multiarch_tree when
suggesting new tests. Folks with Debian systems that can check this for
correctness, it would be much appreciated. The missing chunks I know of
are testing bi-arch peudo-cross-compiling toolchains betwen 32-bit and
64-bit variants of platforms, and the MIPS and ARM Debian toolchains.
Richard Smith [Sun, 26 Feb 2012 09:11:52 +0000 (09:11 +0000)]
Ensure that we delete destructors in the right cases. Specifically:
- variant members with nontrivial destructors make the containing class's
destructor deleted
- check for a virtual destructor after checking for overridden methods in the
base class(es)
- check for an inaccessible operator delete for a class with a virtual
destructor.
Do not try to call an anonymous union field's destructor from the destructor of
the containing class.
Chandler Carruth [Sun, 26 Feb 2012 09:03:21 +0000 (09:03 +0000)]
Add support for PPC and PPC64 multiarch toolchains on Debain.
Patch from Michel Dänzer, sent our way via Jeremy Huddleston who added
64-bit support. I just added one other place where powerpc64-linux-gnu
was missing (we only had powerpc64-unknown-linux-gnu).
I've also added a tree to test out the debian multiarch stuff. I don't
use debian regularly, so I'm not certain this is entirely accurate. If
anyone wants to check it against a debian system and fix any
inaccuracies, fire away. This way at least folks can see how this is
*supposed* to be tested.
It'd be particularly good to get the Debian MIPS toolchains tested in
this way.
Richard Smith [Sun, 26 Feb 2012 00:31:33 +0000 (00:31 +0000)]
Special members which are defaulted or deleted on their first declaration are
trivial if the implicit declaration would be. Don't forget to set the Trivial
flag on the special member as well as on the class. It doesn't seem ideal that
we have two separate mechanisms for storing this information, but this patch
does not attempt to address that.
This leaves us in an interesting position where the has_trivial_X trait for a
class says 'yes' for a deleted but trivial X, but is_trivially_Xable says 'no'.
This seems to be what the standard requires.
Revert r151460 as it is not enough to address the issue.
Original log:
When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.
When evaluating integer expressions handle logical operators outside
VisitBinaryOperator() to reduce stack pressure for source with huge number
of logical operators.
Sebastian Redl [Sat, 25 Feb 2012 20:51:20 +0000 (20:51 +0000)]
CodeGen support for global variables of type std::initializer_list<X>.
This emits a backing array with internal linkage and fills it with data,
then has the initializer_list point at the array. Dynamic initialization
and global destructors are correctly supported.
What doesn't work is nested initializer_lists. I have no idea how to
get them to work, either. However, these should be very rare, and so
I'll just call it a known bug and declare generalized initializers
DONE!
Sebastian Redl [Sat, 25 Feb 2012 20:51:07 +0000 (20:51 +0000)]
Better mangling for new-expressions. Also, although we can't mangle arbitrary initializer lists yet (we will need this), turn the crash into a controlled error.
Richard Smith [Sat, 25 Feb 2012 10:20:59 +0000 (10:20 +0000)]
Fix r151443 to only apply C++11's exception for non-static data member access
in cases where we would otherwise disallow the access, and add a -Wc++98-compat
diagnostic for this C++11 feature.
Richard Smith [Sat, 25 Feb 2012 06:24:24 +0000 (06:24 +0000)]
Fix a regression from r151117: ADL requires that we attempt to complete any
associated classes, since it can find friend functions declared within them,
but overload resolution does not otherwise require argument types to be
complete.
Eli Friedman [Sat, 25 Feb 2012 02:48:22 +0000 (02:48 +0000)]
Work-in-progress for lambda conversion-to-block operator. Still need to implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure).
Ted Kremenek [Sat, 25 Feb 2012 02:09:09 +0000 (02:09 +0000)]
RetainCountChecker: don't adjust the retain count when analyzing a ReturnStmt unless we are in the top-level call frame. We can do more later, but this makes the checker self-consistent (and fixes a crash).
Bugfix: bogus warning -- "invalid use of non-static data member",
when a class is forward declared, and the reference to the data
member in question does not occur within a method body.
Anna Zaks [Fri, 24 Feb 2012 23:56:53 +0000 (23:56 +0000)]
[analyzer] Malloc: reason about the ObjC messages and C++.
Assume none of the ObjC messages defined in system headers free memory,
except for the ones containing 'freeWhenDone' selector. Currently, just
assume that the region escapes to the messages with 'freeWhenDone'
(ideally, we want to treat it as 'free()').
For now, always assume that regions escape when passed to C++ methods.
Douglas Gregor [Fri, 24 Feb 2012 23:56:31 +0000 (23:56 +0000)]
Implement C++11 [over.match.copy]p1b2, which allows the use of
explicit conversion functions to initialize the argument to a
copy/move constructor that itself is the subject of direct
initialization. Since we don't have that much context in overload
resolution, we end up threading more flags :(.
Douglas Gregor [Fri, 24 Feb 2012 22:40:36 +0000 (22:40 +0000)]
For the purposes of building LLVM types, a forward-declared
enumeration type with a fixed underlying type is complete. Fixes
<rdar://problem/10916155>.
Richard Smith [Fri, 24 Feb 2012 22:12:32 +0000 (22:12 +0000)]
When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the
DeclRefExpr can be more const than the declaration is.
Douglas Gregor [Fri, 24 Feb 2012 21:25:53 +0000 (21:25 +0000)]
C++11 [class.ctor]p5 says that
A defaulted default constructor for a class X is defined as deleted if [...]
- X is a union and all of its variant members are of const-qualified type.
A pedantic reading therefore says that
union X { };
has a deleted default constructor, which is both silly and almost
certainly unintended. Pretend as if this this read
- X is a union with one or more variant members, and all of its
variant members are of const-qualified type.
Richard Smith [Fri, 24 Feb 2012 18:42:08 +0000 (18:42 +0000)]
cxx_status: Consistently refer to C++11 as "C++11", not as "C++'11" nor as
"C++0x". Use "C++98" to refer to C++98, not "C++". Add heading for C++98
support section.
Richard Smith [Fri, 24 Feb 2012 18:37:14 +0000 (18:37 +0000)]
cxx_status: extended sizeof has been essentially complete for some time. As
agreed on IRC, any remaining issues are best dealt with as bugs.
We have no __has_feature check for this; please shout if you'd like one. This
feature seems too small to be worth its own release notes bullet (again, please
shout if you disagree).
Douglas Gregor [Fri, 24 Feb 2012 17:41:38 +0000 (17:41 +0000)]
Two minor, related fixes for template instantiation with blocks:
- Make sure that the block expression is instantiation-dependent if the
block is in a dependent context
- Make sure that the C++ 'this' expression gets captured even if we
don't rebuild the AST node during template instantiation. This would
also have manifested as a bug for lambdas.