Commit Graph

10080 Commits

Author SHA1 Message Date
Fariborz Jahanian 6fc3029eb8 objc-arc: Give more descriptive diagnostics when
making unsafe assignment of a retainable 
object, Per John's request.

llvm-svn: 133817
2011-06-24 20:00:03 +00:00
Fariborz Jahanian 5f98da0ea2 objc-arc: Check on a variety of unsafe assignment of retained
objects.  // rdar://9495837

llvm-svn: 133806
2011-06-24 18:25:34 +00:00
Bob Wilson cb8fa3ec1d Fix comments.
llvm-svn: 133805
2011-06-24 18:08:10 +00:00
Argyrios Kyrtzidis cff00d9c12 Rename objc_lifetime -> objc_ownership, and modify diagnostics to talk about 'ownership', not 'lifetime'.
rdar://9477613.

llvm-svn: 133779
2011-06-24 00:08:59 +00:00
Fariborz Jahanian 3ee91fad90 When forming a cycle in objc's inheritance hierarchy,
diagnose it properly and don't throw clang into an
infinit loop. // rdar://9653341

llvm-svn: 133773
2011-06-23 23:16:19 +00:00
Fariborz Jahanian 08e17b506e Improve on warning when objc pointer is used in
c++ catch in fragile abi - per Eli's request.

llvm-svn: 133760
2011-06-23 21:17:59 +00:00
Douglas Gregor a919bd5cee Remove superfluous comment
llvm-svn: 133757
2011-06-23 20:49:34 +00:00
Fariborz Jahanian 676e3a8c83 Move definition of template <typename T> void Decl::dropAttr
to its header to avoid an explicit instantiation.

llvm-svn: 133753
2011-06-23 20:24:38 +00:00
Douglas Gregor 2034c85125 Bump Token::Kind from an unsigned char to an unsigned short, from Anton Lokhmotov
llvm-svn: 133750
2011-06-23 20:15:25 +00:00
Fariborz Jahanian 831f0fc2e0 Support for catching objc pointer objects in c++ catch-statement
in fragile abi mode and some other cleanups. // rdar://8940528

llvm-svn: 133747
2011-06-23 19:00:08 +00:00
Eli Friedman 1408bc9a55 Fix Sema::CheckVectorOperands so that it doesn't try to insert a cast expression into the LHS of a compound assignment. Fixes compound assignment of various "compatible" vector types, including NEON-vector and gcc-vector types.
<rdar://problem/9640356>

llvm-svn: 133737
2011-06-23 18:10:35 +00:00
Fariborz Jahanian 0dfc950609 Remove multiple use of weak_import attribute on
same declaration. Templatize dropAttr for general use.

llvm-svn: 133724
2011-06-23 17:50:10 +00:00
Fariborz Jahanian be5a4416ff Remove weak_import attribute on new declaration.
// rdar://9538608

llvm-svn: 133721
2011-06-23 16:18:44 +00:00
Dylan Noblesmith 321cdb8551 avoid using config.h in public headers
This is the only usage in clang's headers, and it's for a define
that only exists on CMake builds for the sake of the MSVC compiler,
so just use an ifdef instead.

Also add an include for config.h in a file that actually needs it,
and was picking it up by accident indirectly.

llvm-svn: 133710
2011-06-23 12:20:57 +00:00
Douglas Gregor 5476205b9b Move all of Sema's member-access-related checking out of SemaExpr.cpp
and into a new file, SemaExprMember.cpp, bringing SemaExpr.cpp just
under 10,000 lines of code (ugh). No functionality change, although I
intend to do some refactoring of this code to address PR8368 at some
point in the "near" future.

llvm-svn: 133674
2011-06-23 00:49:38 +00:00
Argyrios Kyrtzidis ab72b6792b Allow unavailable function calls inside unavailable functions in C++/ObjC++ as well. rdar://9660196
llvm-svn: 133672
2011-06-23 00:41:50 +00:00
Fariborz Jahanian 33e022650a Issue warning if weak_import attribute is added to an already
declared variable and ignore it. // rdar://9538608

llvm-svn: 133654
2011-06-22 22:08:50 +00:00
Fariborz Jahanian 0a3cfcc87f Alloa catching Objective-C id's being thrown with C++ throw
in Darwin's fragile abi mode.  // rdar://8940528

llvm-svn: 133639
2011-06-22 20:21:51 +00:00
Manuel Klimek f2b4b69346 Changes ParenListExpr to always require a type.
Removes dead code found in the process.
Adds a test to verify that ParenListExprs do not have NULL types.

llvm-svn: 133637
2011-06-22 20:02:16 +00:00
Douglas Gregor 3bde9b15a1 Copy diagnostic pragmas to the preprocessed output, from Richard Osborne!
llvm-svn: 133633
2011-06-22 19:41:48 +00:00
Argyrios Kyrtzidis 92b12187dd Put all ARC-related warnings into the "arc" diagnostic group.
llvm-svn: 133626
2011-06-22 18:03:56 +00:00
Argyrios Kyrtzidis 694f75db13 Change "cannot assign retained object.." warning to "assigning retained object.."
llvm-svn: 133625
2011-06-22 18:03:53 +00:00
Douglas Gregor 2fa40a3a06 Give MaterializeTemporaryExpr the exact type of the lvalue it binds
to, including cv-qualifications.

llvm-svn: 133618
2011-06-22 15:05:02 +00:00
Douglas Gregor b6ea7d2e2d Fix typo in comment
llvm-svn: 133617
2011-06-22 14:41:20 +00:00
Argyrios Kyrtzidis c0c5dd2651 Introduce DelayedCleanupPool useful for simplifying clean-up of certain resources that, while their
lifetime is well-known and restricted, cleaning them up manually is easy to miss and cause a leak.

Use it to plug the leaking of TemplateIdAnnotation objects. rdar://9634138.

llvm-svn: 133610
2011-06-22 06:09:49 +00:00
Alexis Hunt fe268d1045 Extend the deleted overload candidate note to cover all cases. It
probably shouldn't cover the implicit member case, but it needs to until
more descriptive diagnostics are implemented.

llvm-svn: 133594
2011-06-22 01:05:16 +00:00
Alexis Hunt 491ec60802 Attempt to reapply this patch for caching copy assignment operator
lookup. Previously, it was breaking self-host, but it's been a week and
a half and I can't reproduce, so I need to see if it's still failing.

llvm-svn: 133581
2011-06-21 23:42:56 +00:00
Bob Wilson 05e4135fe0 Fix a case that I missed in r133550.
llvm-svn: 133551
2011-06-21 21:58:07 +00:00
Bob Wilson f64a560d74 Make InitHeaderSearch::AddPath and HeaderSearchOptions::AddPath consistent
use an "IgnoreSysRoot" argument.  HeaderSearchOptions had been using the
opposite form with "IsSysRootRelative", which made for much confusion when
looking at true/false values in calls in AddPath.  No functional change.

llvm-svn: 133550
2011-06-21 21:53:08 +00:00
Bob Wilson b02ea3d70d Fix the default libc++ header search path to be sysrooted. Radar 9639692.
The -cxx-isystem path is not prefixed with the sysroot directory, so it's
not a good way for the driver to set the system default C++ search path.
Instead, add -stdlib as a cc1 option and teach the frontend how to find the
headers.  The driver can then just pass -stdlib through to "cc1".

llvm-svn: 133547
2011-06-21 21:12:29 +00:00
Bob Wilson 5464de6d90 Fix cut-and-paste error: --stdlib is an alias for -stdlib, not -std.
llvm-svn: 133546
2011-06-21 21:12:21 +00:00
Daniel Dunbar 8f1fe5b5c3 Driver: Factor out IsUsingLTO helper function.
llvm-svn: 133542
2011-06-21 20:55:08 +00:00
Daniel Dunbar d3f3d932ee IRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
- Changes bit-field access policy to try to use (aligned) register sized accesses.

The idea here is that by using larger accesses we expose more coalescing
potential to the backend when we have situations like adjacent bit-fields in the
same structure (which is common), and that the backend should be smart enough to
narrow the accesses down when no coalescing is done or when it is shown not to
be profitable.

--
$ clang -m32 -O3 -S -o - t.c
_f0:                                    ## @f0
	pushl	%ebp
	movl	%esp, %ebp
	movl	8(%ebp), %eax
	movb	(%eax), %cl
	andb	$-128, %cl
	orb	$1, %cl
	movb	%cl, (%eax)
	movb	1(%eax), %cl
	andb	$-128, %cl
	orb	$1, %cl
	movb	%cl, 1(%eax)
	movb	2(%eax), %cl
	andb	$-128, %cl
	orb	$1, %cl
	movb	%cl, 2(%eax)
	movb	3(%eax), %cl
	andb	$-128, %cl
	orb	$1, %cl
	movb	%cl, 3(%eax)
	popl	%ebp
	ret

$ clang -m32 -O3 -S -o - t.c -Xclang -fuse-register-sized-bitfield-access
_f0:                                    ## @f0
	pushl	%ebp
	movl	%esp, %ebp
	movl	8(%ebp), %eax
	movl	$-2139062144, %ecx      ## imm = 0xFFFFFFFF80808080
	andl	(%eax), %ecx
	orl	$16843009, %ecx         ## imm = 0x1010101
	movl	%ecx, (%eax)
	popl	%ebp
	ret
--

llvm-svn: 133532
2011-06-21 18:54:46 +00:00
Daniel Dunbar d574d6bbff Basic: Add TargetInfo::getRegisterWidth hook.
- For clarity only, currently just assumes register width == long width.

llvm-svn: 133531
2011-06-21 18:54:42 +00:00
Douglas Gregor d410c08ebe A few tweaks to MaterializeTemporaryExpr suggested by John.
llvm-svn: 133528
2011-06-21 18:20:46 +00:00
Fariborz Jahanian 7887637c82 objc-arc: CodeGen part of unbridged cast of CF types.
// rdar://9474349

llvm-svn: 133525
2011-06-21 17:38:29 +00:00
Douglas Gregor fe31481f68 Introduce a new AST node describing reference binding to temporaries.
MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

  const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value. 

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.

llvm-svn: 133521
2011-06-21 17:03:29 +00:00
Jay Foad 9a6b09874d Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

llvm-svn: 133515
2011-06-21 15:13:30 +00:00
Nick Lewycky ca6b90d8af Add support for -Wa,--noexecstack when building from a non-assembly file. For
an assembly file it worked correctly, while for a .c file it would given an
error about how --noexecstack is not a supported argument to -Wa.

llvm-svn: 133489
2011-06-21 00:14:18 +00:00
Eric Christopher cdd3635b09 Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers.

Fixes part of rdar://9425559

llvm-svn: 133485
2011-06-21 00:05:20 +00:00
Fariborz Jahanian 4ad5686399 objc-arc: allow explicit unbridged casts if the source of the cast is a
message sent to an objc method (or property access)
// rdar://9474349

llvm-svn: 133469
2011-06-20 20:54:42 +00:00
Argyrios Kyrtzidis 01bf777597 Warn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.
Patch by Henry Mason with tweaks by me.

llvm-svn: 133453
2011-06-20 18:41:26 +00:00
Chandler Carruth 2889f0c75b Remove this poor "abstraction" from the AST. Sorry! =D
llvm-svn: 133426
2011-06-20 07:38:56 +00:00
Francois Pichet 1b8d5ddafb Remove more unnecessary #include <llvm/ADT/SmallVector.h>
llvm-svn: 133418
2011-06-20 06:11:46 +00:00
Francois Pichet b755e4935c Remove unnecessary include.
llvm-svn: 133417
2011-06-20 05:47:47 +00:00
Chandler Carruth 92c810be2c Restructure the API in Type based on a conversation with Richard Smith.
This makes 'isPointerLikeType' a little less confusing, and pulls the
decay check into a separate interface that is much more clear and
concrete. Also, just implement these as logical wrappers around other
predicates. Having a switch based implementation isn't likely to be
necessary. We can try to optimize them later if they show up on
a profile.

llvm-svn: 133405
2011-06-20 01:23:19 +00:00
Chandler Carruth 3f3957ce04 Turn -Wnull-arithmetic back on by default -- we now have tests for the
false positives, including those in the GCC test suite, and don't warn
about them.

Let me know if this causes fallout, we can turn it back off if needed.

llvm-svn: 133384
2011-06-19 09:05:19 +00:00
Chandler Carruth e1db1cf0c3 Add test cases for false positives on -Wnull-arithmetic from Richard
Trieu, and fix them by checking for array and function types as well as
pointer types.

I've added a predicate method on Type to bundle together the logic we're
using here: isPointerLikeType(). I'd welcome better names for this
predicate, this is the best I came up with. It's implemented as a switch
to be a touch lighter weight than all the chained isa<...> casts that
would result otherwise.

llvm-svn: 133383
2011-06-19 09:05:14 +00:00
Francois Pichet f6d6808485 Add support for MSVC __debugbreak compiler intrinsic.
llvm-svn: 133372
2011-06-19 00:16:12 +00:00
Chandler Carruth 53e61b05ce Accept no-return stripping conversions for pointer type arguments after
deducing template parameter types. Recently Clang began enforcing the
more strict checking that the argument type and the deduced function
parameter type (after substitution) match, but that only consideres
qualification conversions.

One problem with this patch is that we check noreturn conversions and
qualification conversions independently. If a valid conversion would
require *both*, perhaps interleaved with each other, it will be
rejected. If this actually occurs (I'm not yet sure it does) and is in
fact a problem (I'm not yet sure it is), there is a FIXME to implement
more intelligent conversion checking.

However, this step at least allows Clang to resume accepting valid code
we're seeing in the wild.

llvm-svn: 133327
2011-06-18 01:19:03 +00:00