]> granicus.if.org Git - clang/log
clang
13 years ago[arcmt] Break apart Transforms.cpp.
Argyrios Kyrtzidis [Tue, 21 Jun 2011 20:20:39 +0000 (20:20 +0000)]
[arcmt] Break apart Transforms.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133539 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: Add support for unbridged cast of
Fariborz Jahanian [Tue, 21 Jun 2011 19:42:38 +0000 (19:42 +0000)]
objc-arc: Add support for unbridged cast of
__builtin___CFStringMakeConstantString and CF typed function calls
with explicit cf_returns_retained/cf_returns_not_retained attributes.
// rdar://9544832

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133535 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIRgen: Add a -fuse-register-sized-bitfield-access option, for testing.
Daniel Dunbar [Tue, 21 Jun 2011 18:54:46 +0000 (18:54 +0000)]
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
--

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133532 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBasic: Add TargetInfo::getRegisterWidth hook.
Daniel Dunbar [Tue, 21 Jun 2011 18:54:42 +0000 (18:54 +0000)]
Basic: Add TargetInfo::getRegisterWidth hook.
 - For clarity only, currently just assumes register width == long width.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133531 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIRgen: Add CGOptions to CGTypes.
Daniel Dunbar [Tue, 21 Jun 2011 18:54:39 +0000 (18:54 +0000)]
IRgen: Add CGOptions to CGTypes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133530 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago^cat^cast^
Fariborz Jahanian [Tue, 21 Jun 2011 18:21:32 +0000 (18:21 +0000)]
^cat^cast^

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133529 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoA few tweaks to MaterializeTemporaryExpr suggested by John.
Douglas Gregor [Tue, 21 Jun 2011 18:20:46 +0000 (18:20 +0000)]
A few tweaks to MaterializeTemporaryExpr suggested by John.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133528 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd comment before CheckObjCARCConversion is called on
Fariborz Jahanian [Tue, 21 Jun 2011 18:19:51 +0000 (18:19 +0000)]
Add comment before CheckObjCARCConversion is called on
Expr value not getting changed by this call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133527 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSwitch the order of the notes for the parentheses suggested in the case
Chandler Carruth [Tue, 21 Jun 2011 18:07:33 +0000 (18:07 +0000)]
Switch the order of the notes for the parentheses suggested in the case
of: a + b ? x : y. In our testing of this flag we've yet to hit a single
case where the existing precedence was correct, so we should suggest
grouping the ?: first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133526 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: CodeGen part of unbridged cast of CF types.
Fariborz Jahanian [Tue, 21 Jun 2011 17:38:29 +0000 (17:38 +0000)]
objc-arc: CodeGen part of unbridged cast of CF types.
// rdar://9474349

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133525 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a crash when a pointer-to-member function is called in the condition
Chandler Carruth [Tue, 21 Jun 2011 17:22:09 +0000 (17:22 +0000)]
Fix a crash when a pointer-to-member function is called in the condition
expression of '?:'. Add a test case for this pattern, and also test the
code that led to the crash in a "working" case as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133523 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIntroduce a new AST node describing reference binding to temporaries.
Douglas Gregor [Tue, 21 Jun 2011 17:03:29 +0000 (17:03 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake more use of llvm::StringRef in various APIs. In particular, don't
Jay Foad [Tue, 21 Jun 2011 15:13:30 +0000 (15:13 +0000)]
Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133515 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix typo. From Damjan Marion.
Joerg Sonnenberger [Tue, 21 Jun 2011 08:45:08 +0000 (08:45 +0000)]
Fix typo. From Damjan Marion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133511 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDe-Unicode-ify in comments.
NAKAMURA Takumi [Tue, 21 Jun 2011 03:19:28 +0000 (03:19 +0000)]
De-Unicode-ify in comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133501 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAlso fix the warning about using "clang" instead of %clang.
Nick Lewycky [Tue, 21 Jun 2011 00:23:47 +0000 (00:23 +0000)]
Also fix the warning about using "clang" instead of %clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133492 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove the leading hyphen so that grep doesn't parse it as one long option :)
Nick Lewycky [Tue, 21 Jun 2011 00:21:22 +0000 (00:21 +0000)]
Remove the leading hyphen so that grep doesn't parse it as one long option :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133491 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDriver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
Daniel Dunbar [Tue, 21 Jun 2011 00:20:17 +0000 (00:20 +0000)]
Driver/Darwin: Honor -Xarch_FOO when the arch matches either the toolchain or
the architecture being bound.
 - Fixes things like -Xarch_armv7.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133490 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for -Wa,--noexecstack when building from a non-assembly file. For
Nick Lewycky [Tue, 21 Jun 2011 00:14:18 +0000 (00:14 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133489 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCanonicalize register names properly.
Eric Christopher [Tue, 21 Jun 2011 00:07:10 +0000 (00:07 +0000)]
Canonicalize register names properly.

Fixes rdar://9425559

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133486 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove additional register names to their own lookup, separate from
Eric Christopher [Tue, 21 Jun 2011 00:05:20 +0000 (00:05 +0000)]
Move additional register names to their own lookup, separate from
register aliases. Fixes unnecessary renames of clobbers.

Fixes part of rdar://9425559

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133485 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Always add '__bridge' cast when 'self' is cast to a C pointer. rdar://9644061
Argyrios Kyrtzidis [Mon, 20 Jun 2011 23:39:20 +0000 (23:39 +0000)]
[arcmt] Always add '__bridge' cast when 'self' is cast to a C pointer.  rdar://9644061

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133480 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Finish size argument checking for strncat (and strncpy).
Jordy Rose [Mon, 20 Jun 2011 21:55:40 +0000 (21:55 +0000)]
[analyzer] Finish size argument checking for strncat (and strncpy).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133472 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoobjc-arc: allow explicit unbridged casts if the source of the cast is a
Fariborz Jahanian [Mon, 20 Jun 2011 20:54:42 +0000 (20:54 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133469 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Find out whether there is an ARC runtime directly from the triple, avoid...
Argyrios Kyrtzidis [Mon, 20 Jun 2011 19:59:52 +0000 (19:59 +0000)]
[arcmt] Find out whether there is an ARC runtime directly from the triple, avoid hacky delegation to the driver for that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133464 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWarn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.
Argyrios Kyrtzidis [Mon, 20 Jun 2011 18:41:26 +0000 (18:41 +0000)]
Warn for un-parenthesized '&' inside '|' (a & b | c), rdar://9553326.

Patch by Henry Mason with tweaks by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133453 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agollvm-gcc treats a tentative definition with a previous
Fariborz Jahanian [Mon, 20 Jun 2011 17:50:03 +0000 (17:50 +0000)]
llvm-gcc treats a tentative definition with a previous
(or follow up) extern declaration with weak_import as
an actual definition. make clang follows this behavior.
// rdar://9538608
llvm-gcc treats an extern declaration with weak_import

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133450 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDefine va_copy when in C++0x mode; C++0x picked it up from C99.
Douglas Gregor [Mon, 20 Jun 2011 15:03:22 +0000 (15:03 +0000)]
Define va_copy when in C++0x mode; C++0x picked it up from C99.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133438 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDefine __cplusplus to 201103L when in (non-GNU) C++0x mode.
Douglas Gregor [Mon, 20 Jun 2011 15:00:58 +0000 (15:00 +0000)]
Define __cplusplus to 201103L when in (non-GNU) C++0x mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133437 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoChange how PHINodes store their operands.
Jay Foad [Mon, 20 Jun 2011 14:38:01 +0000 (14:38 +0000)]
Change how PHINodes store their operands.

Change PHINodes to store simple pointers to their incoming basic blocks,
instead of full-blown Uses.

Note that this loses an optimization in SplitCriticalEdge(), because we
can no longer walk the use list of a BasicBlock to find phi nodes. See
the comment I removed starting "However, the foreach loop is slow for
blocks with lots of predecessors".

Extend replaceAllUsesWith() on a BasicBlock to also update any phi
nodes in the block's successors. This mimics what would have happened
when PHINodes were proper Users of their incoming blocks. (Note that
this only works if OldBB->replaceAllUsesWith(NewBB) is called when
OldBB still has a terminator instruction, so it still has some
successors.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133435 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse an explicitly 64-bit triple flag to ensure we can easily verify the
Chandler Carruth [Mon, 20 Jun 2011 08:59:25 +0000 (08:59 +0000)]
Use an explicitly 64-bit triple flag to ensure we can easily verify the
types printed in various diagnostics.

We could omit checking for the types, but that can mask errors where the
wrong type is streamed into the diagnostic. There was at least one of
these caught by this test already.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133429 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a problem with the diagnostics of invalid arithmetic with function
Chandler Carruth [Mon, 20 Jun 2011 07:52:11 +0000 (07:52 +0000)]
Fix a problem with the diagnostics of invalid arithmetic with function
pointers I found while working on the NULL arithmetic warning. We here
always assuming the LHS was the pointer, instead of using the selected
pointer expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133428 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove this poor "abstraction" from the AST. Sorry! =D
Chandler Carruth [Mon, 20 Jun 2011 07:38:56 +0000 (07:38 +0000)]
Remove this poor "abstraction" from the AST. Sorry! =D

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133426 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMove away from the poor "abstraction" I added to Type. John argued
Chandler Carruth [Mon, 20 Jun 2011 07:38:51 +0000 (07:38 +0000)]
Move away from the poor "abstraction" I added to Type. John argued
effectively that this abstraction simply doesn't exist. That is
highlighted by the fact that by using it we were papering over a more
serious error in this warning: the fact that we warned for *invalid*
constructs involving member pointers and block pointers.

I've fixed the obvious issues with the warning here, but this is
confirming an original suspicion that this warning's implementation is
flawed. I'm looking into how we can implement this more reasonably. WIP
on that front.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133425 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove more unnecessary #include <llvm/ADT/SmallVector.h>
Francois Pichet [Mon, 20 Jun 2011 06:11:46 +0000 (06:11 +0000)]
Remove more unnecessary #include <llvm/ADT/SmallVector.h>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133418 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove unnecessary include.
Francois Pichet [Mon, 20 Jun 2011 05:47:47 +0000 (05:47 +0000)]
Remove unnecessary include.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133417 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate to match mainline ConstantStruct::get API change. Also, use
Chris Lattner [Mon, 20 Jun 2011 04:01:35 +0000 (04:01 +0000)]
Update to match mainline ConstantStruct::get API change.  Also, use
ConvertType on InitListExprs as they are being converted.  This is
needed for a forthcoming patch, and improves the IR generated anyway
(see additional type names in testcases).

This patch also converts a bunch of std::vector's in CGObjCMac to use
C arrays.  There are a ton more that should be converted as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133413 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Replace stream-built error message with constant string. No functionality...
Jordy Rose [Mon, 20 Jun 2011 03:51:53 +0000 (03:51 +0000)]
[analyzer] Replace stream-built error message with constant string. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133410 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Re-enable checking for strncpy, along with a new validation of the size...
Jordy Rose [Mon, 20 Jun 2011 03:49:16 +0000 (03:49 +0000)]
[analyzer] Re-enable checking for strncpy, along with a new validation of the size argument. strncat is not yet up-to-date, but I'm leaving it enabled for now (there shouldn't be any false positives, at least...)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133408 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[analyzer] Eliminate "byte string function" from CStringChecker's diagnostics, and...
Jordy Rose [Mon, 20 Jun 2011 02:06:40 +0000 (02:06 +0000)]
[analyzer] Eliminate "byte string function" from CStringChecker's diagnostics, and make it easier to provide custom messages for overflow checking, in preparation for re-enabling strncpy checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133406 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRestructure the API in Type based on a conversation with Richard Smith.
Chandler Carruth [Mon, 20 Jun 2011 01:23:19 +0000 (01:23 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133405 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMore clarifications.
John McCall [Sun, 19 Jun 2011 10:12:24 +0000 (10:12 +0000)]
More clarifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133387 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the intro to the runtime-functions section.
John McCall [Sun, 19 Jun 2011 09:59:33 +0000 (09:59 +0000)]
Improve the intro to the runtime-functions section.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133386 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDescribe the ARC runtime support calls.
John McCall [Sun, 19 Jun 2011 09:36:02 +0000 (09:36 +0000)]
Describe the ARC runtime support calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133385 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTurn -Wnull-arithmetic back on by default -- we now have tests for the
Chandler Carruth [Sun, 19 Jun 2011 09:05:19 +0000 (09:05 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133384 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd test cases for false positives on -Wnull-arithmetic from Richard
Chandler Carruth [Sun, 19 Jun 2011 09:05:14 +0000 (09:05 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133383 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHandle decltype keyword in Parser::isDeclarationSpecifier.
Francois Pichet [Sun, 19 Jun 2011 08:02:06 +0000 (08:02 +0000)]
Handle decltype keyword in Parser::isDeclarationSpecifier.
Fixes PR10154. Found by parsing MFC 2010 code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133380 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for MSVC __debugbreak compiler intrinsic.
Francois Pichet [Sun, 19 Jun 2011 00:16:12 +0000 (00:16 +0000)]
Add support for MSVC __debugbreak compiler intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133372 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoupdate for api change.
Chris Lattner [Sat, 18 Jun 2011 22:49:11 +0000 (22:49 +0000)]
update for api change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133365 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove dead variables.
Benjamin Kramer [Sat, 18 Jun 2011 10:34:07 +0000 (10:34 +0000)]
Remove dead variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133346 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago80 cols.
Benjamin Kramer [Sat, 18 Jun 2011 10:34:00 +0000 (10:34 +0000)]
80 cols.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133345 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove more unnecessary dependencies now that the Frontend -> ARCMigrate
Chandler Carruth [Sat, 18 Jun 2011 09:07:35 +0000 (09:07 +0000)]
Remove more unnecessary dependencies now that the Frontend -> ARCMigrate
edge has been broken.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133343 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agotools/arcmt-test: Don't attempt to link redundant libclang (clang-c).
NAKAMURA Takumi [Sat, 18 Jun 2011 08:52:27 +0000 (08:52 +0000)]
tools/arcmt-test: Don't attempt to link redundant libclang (clang-c).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133342 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClarify the semantics of init methods, and point out a few places
John McCall [Sat, 18 Jun 2011 08:15:19 +0000 (08:15 +0000)]
Clarify the semantics of init methods, and point out a few places
where mismatched semantics can cause undefined behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133341 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoA couple of minor changes to the ARC spec, plus a new section
John McCall [Sat, 18 Jun 2011 07:31:30 +0000 (07:31 +0000)]
A couple of minor changes to the ARC spec, plus a new section
specifying that retain/release/autorelease/retainCount are forbidden,
plus a section talking about the behavior of dealloc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133340 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAccept no-return stripping conversions for pointer type arguments after
Chandler Carruth [Sat, 18 Jun 2011 01:19:03 +0000 (01:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133327 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initializatio...
Argyrios Kyrtzidis [Sat, 18 Jun 2011 00:53:41 +0000 (00:53 +0000)]
[arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initialization of SourceManager
because it is going to modify the input file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133323 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Const'ify.
Argyrios Kyrtzidis [Sat, 18 Jun 2011 00:53:34 +0000 (00:53 +0000)]
[arcmt] Const'ify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133322 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped...
Argyrios Kyrtzidis [Fri, 17 Jun 2011 23:49:31 +0000 (23:49 +0000)]
[arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped it would be.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133315 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix regression with @encode string. rdar://9624314.
Argyrios Kyrtzidis [Fri, 17 Jun 2011 23:19:38 +0000 (23:19 +0000)]
Fix regression with @encode string. rdar://9624314.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133312 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoObjective-C++ ARC: eliminate the utterly unjustified loophole that
Douglas Gregor [Fri, 17 Jun 2011 23:16:24 +0000 (23:16 +0000)]
Objective-C++ ARC: eliminate the utterly unjustified loophole that
silently dropped ownership qualifiers that were being applied to
ownership-qualified, substituted type that was *not* a substituted
template type parameter. We now provide a diagnostic in such cases,
and recover by dropping the added qualifiers.

Document this behavior in the ARC specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133309 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoObjective-C++ ARC: do not mangle __unsafe_unretained lifetime
Douglas Gregor [Fri, 17 Jun 2011 22:26:49 +0000 (22:26 +0000)]
Objective-C++ ARC: do not mangle __unsafe_unretained lifetime
qualifiers, so that an __unsafe_unretained-qualified type T in ARC code
will have the same mangling as T in non-ARC code, improving ABI
interoperability. This works now because we infer or require a
lifetime qualifier everywhere one can appear in an external
interface. Another part of <rdar://problem/9595486>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133306 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a grammaro
Douglas Gregor [Fri, 17 Jun 2011 22:19:27 +0000 (22:19 +0000)]
Fix a grammaro

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133304 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoObjective-ARC++: infer template type arguments of
Douglas Gregor [Fri, 17 Jun 2011 22:11:49 +0000 (22:11 +0000)]
Objective-ARC++: infer template type arguments of
ownership-unqualified retainable object type as __strong. This allows
us to write, e.g.,

  std::vector<id>

and we'll infer that the vector's element types have __strong
ownership semantics, which is far nicer than requiring:

  std::vector<__strong id>

Note that we allow one to override the ownership qualifier of a
substituted template type parameter, e.g., given

  template<typename T>
  struct X {
    typedef __weak T type;
  };

X<id> is treated the same as X<__strong id>. At instantiation type,
the __weak in "__weak T" overrides the (inferred or specified)
__strong on the template argument type, so that we can still provide
metaprogramming transformations.

This is part of <rdar://problem/9595486>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133303 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOnly accept __bridge_retain in system headers, as Doug suggested.
John McCall [Fri, 17 Jun 2011 21:56:12 +0000 (21:56 +0000)]
Only accept __bridge_retain in system headers, as Doug suggested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133300 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAs a hopefully temporary workaround for a header mistake, treat
John McCall [Fri, 17 Jun 2011 21:23:37 +0000 (21:23 +0000)]
As a hopefully temporary workaround for a header mistake, treat
__bridge_retain as a synonym for __bridge_retained.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133295 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a minor hack to avoid using isNullPointerConstant on a hot path. Fixes -O0 compi...
Eli Friedman [Fri, 17 Jun 2011 20:52:22 +0000 (20:52 +0000)]
Add a minor hack to avoid using isNullPointerConstant on a hot path.  Fixes -O0 compile-time regressions from r133196.

rdar://9629775 .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133290 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPut the new warning from revision 133196 on NULL arithmetic behind the flag -Wnull...
Richard Trieu [Fri, 17 Jun 2011 20:35:48 +0000 (20:35 +0000)]
Put the new warning from revision 133196 on NULL arithmetic behind the flag -Wnull-arthimetic and set to DefaultIgnore.  A few edge cases need to be worked out before this can be set to default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133287 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't emit 'unavailable' errors inside an unavailable function. rdar://9623855.
Argyrios Kyrtzidis [Fri, 17 Jun 2011 17:28:30 +0000 (17:28 +0000)]
Don't emit 'unavailable' errors inside an unavailable function. rdar://9623855.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133264 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoLoosen up the IR matching slightly
Douglas Gregor [Fri, 17 Jun 2011 17:23:28 +0000 (17:23 +0000)]
Loosen up the IR matching slightly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133263 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove another variable.
Eric Christopher [Fri, 17 Jun 2011 17:04:30 +0000 (17:04 +0000)]
Remove another variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133262 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen emitting a compound literal of POD type, continue to emit a
Douglas Gregor [Fri, 17 Jun 2011 16:37:20 +0000 (16:37 +0000)]
When emitting a compound literal of POD type, continue to emit a
separate aggregate temporary and then memcpy it over to the
destination. This fixes a regression I introduced with r133235, where
the compound literal on the RHS of an assignment makes use of the
structure on the LHS of the assignment.

I'm deeply suspicious of AggExprEmitter::VisitBinAssign()'s
optimization where it emits the RHS of an aggregate assignment
directly into the LHS lvalue without checking whether there is any
aliasing between the LHS/RHS. However, I'm not in a position to
revisit this now.

Big thanks to Eli for finding the regression!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133261 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix refactoro, silencing an MSVC warning. Thanks, Francois.
Douglas Gregor [Fri, 17 Jun 2011 14:36:00 +0000 (14:36 +0000)]
Fix refactoro, silencing an MSVC warning. Thanks, Francois.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133257 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPerform an acquire memory barrier on the fast path of a thread-safe
John McCall [Fri, 17 Jun 2011 07:33:57 +0000 (07:33 +0000)]
Perform an acquire memory barrier on the fast path of a thread-safe
static initializer check, as required by the Itanium ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133250 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitialize a couple of variables to shut GCC up.
John McCall [Fri, 17 Jun 2011 06:50:50 +0000 (06:50 +0000)]
Initialize a couple of variables to shut GCC up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133246 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoObjective-C fast enumeration loop variables are not retained in ARC, but
John McCall [Fri, 17 Jun 2011 06:42:21 +0000 (06:42 +0000)]
Objective-C fast enumeration loop variables are not retained in ARC, but
they should still be officially __strong for the purposes of errors,
block capture, etc.  Make a new bit on variables, isARCPseudoStrong(),
and set this for 'self' and these enumeration-loop variables.  Change
the code that was looking for the old patterns to look for this bit,
and change IR generation to find this bit and treat the resulting
variable as __unsafe_unretained for the purposes of init/destroy in
the two places it can come up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133243 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoClean up test to avoid using standard headers and remove an unneeded
Eric Christopher [Fri, 17 Jun 2011 06:16:34 +0000 (06:16 +0000)]
Clean up test to avoid using standard headers and remove an unneeded
#define.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133241 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoExtend the deduced/actual argument type checking of C++
Douglas Gregor [Fri, 17 Jun 2011 05:31:46 +0000 (05:31 +0000)]
Extend the deduced/actual argument type checking of C++
[temp.deduct.call]p4 to the deduction performed for 'auto', finishing
the fix for PR9233.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133239 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMake this test suitable for optimized builds by avoiding the name.
Eric Christopher [Fri, 17 Jun 2011 05:24:17 +0000 (05:24 +0000)]
Make this test suitable for optimized builds by avoiding the name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133238 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFactor the checking of the deduced argument type against the actual
Douglas Gregor [Fri, 17 Jun 2011 05:18:17 +0000 (05:18 +0000)]
Factor the checking of the deduced argument type against the actual
argument type for C++ [temp.deduct.call]p4 out of
Sema::FinishTemplateArgumentDeduction(). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133237 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen an explicit specialization has a storage specifier, error if that
Douglas Gregor [Fri, 17 Jun 2011 05:09:08 +0000 (05:09 +0000)]
When an explicit specialization has a storage specifier, error if that
storage specifier is different from the storage specifier on the
template. If that storage specifier is the same, then we only warn.

Thanks to John for the prodding.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133236 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement proper support for generating code for compound literals in
Douglas Gregor [Fri, 17 Jun 2011 04:59:12 +0000 (04:59 +0000)]
Implement proper support for generating code for compound literals in
C++, which means:
  - binding the temporary as needed in Sema, so that we generate the
  appropriate call to the destructor, and
  - emitting the compound literal into the appropriate location for
  the aggregate, rather than trying to emit it as a temporary and
  memcpy() it.

Fixes PR10138 / <rdar://problem/9615901>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133235 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDowngrade the error complaining about presence of a storage class
Douglas Gregor [Fri, 17 Jun 2011 03:41:35 +0000 (03:41 +0000)]
Downgrade the error complaining about presence of a storage class
specifier on an explicit specialization to a warning, since neither
EDG nor GCC diagnose this code as ill-formed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133232 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCheck the specific target to figure out if a constraint is a valid
Eric Christopher [Fri, 17 Jun 2011 01:53:34 +0000 (01:53 +0000)]
Check the specific target to figure out if a constraint is a valid
register constraint. Note that we're not checking if the register itself
is valid for the constraint.

Fixes rdar://9382985

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133226 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd some more memory constraints for ARM.
Eric Christopher [Fri, 17 Jun 2011 01:40:49 +0000 (01:40 +0000)]
Add some more memory constraints for ARM.

Part of rdar://9197685

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133225 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoOn ARM make sure that we continue translating 'p' to 'r' for the
Eric Christopher [Fri, 17 Jun 2011 00:40:18 +0000 (00:40 +0000)]
On ARM make sure that we continue translating 'p' to 'r' for the
constraints.

rdar://9618597

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133222 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen synthesizing implicit copy/move constructors and copy/move assignment
John McCall [Fri, 17 Jun 2011 00:18:42 +0000 (00:18 +0000)]
When synthesizing implicit copy/move constructors and copy/move assignment
operators, don't make an initializer or sub-operation for zero-width
bitfields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133221 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCheck for placeholder expressions before promoting an argument passed
Douglas Gregor [Fri, 17 Jun 2011 00:15:10 +0000 (00:15 +0000)]
Check for placeholder expressions before promoting an argument passed
through an ellipsis. Fixes <rdar://problem/9623945>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133219 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for -force_load flag, for compat with Apple gcc. rdar://9555962 .
Eli Friedman [Thu, 16 Jun 2011 23:59:43 +0000 (23:59 +0000)]
Add support for -force_load flag, for compat with Apple gcc.  rdar://9555962 .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133218 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove ARCMigrate from more builds that it isn't needed in now that the
Chandler Carruth [Thu, 16 Jun 2011 23:53:28 +0000 (23:53 +0000)]
Remove ARCMigrate from more builds that it isn't needed in now that the
layering problem has been addressed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133217 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoBe sure to try a final ARC-production even in Objective-C++.
John McCall [Thu, 16 Jun 2011 23:24:51 +0000 (23:24 +0000)]
Be sure to try a final ARC-production even in Objective-C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133215 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFinish 2 sentences.
Francois Pichet [Thu, 16 Jun 2011 23:19:36 +0000 (23:19 +0000)]
Finish 2 sentences.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133214 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agocomment improvements.
Chris Lattner [Thu, 16 Jun 2011 22:58:30 +0000 (22:58 +0000)]
comment improvements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133213 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a regression introduced by r131955 which broke #include_next in subtle situations
Chris Lattner [Thu, 16 Jun 2011 22:58:10 +0000 (22:58 +0000)]
Fix a regression introduced by r131955 which broke #include_next in subtle situations
because the Angled directories and the System directories were not being uniqued
together, breaking #include_next.  I'll see about a testcase, but it will be insane.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133212 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agocode cleanups, no behavior change.
Chris Lattner [Thu, 16 Jun 2011 22:56:45 +0000 (22:56 +0000)]
code cleanups, no behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133211 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFor the purpose of @encode'ing, accept 'void' type
Fariborz Jahanian [Thu, 16 Jun 2011 22:34:44 +0000 (22:34 +0000)]
For the purpose of @encode'ing, accept 'void' type
(even though it is incomplete type) because gcc
says so. // rdar://9622422

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133208 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agocmake may require LIT_TOOLS_DIR.
Andrew Trick [Thu, 16 Jun 2011 21:47:59 +0000 (21:47 +0000)]
cmake may require LIT_TOOLS_DIR.
Reviewed by chapuni. Sorry for breaking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133199 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a new warning when a NULL constant is used in arithmetic operations. The warning...
Richard Trieu [Thu, 16 Jun 2011 21:36:56 +0000 (21:36 +0000)]
Add a new warning when a NULL constant is used in arithmetic operations.  The warning will fire on cases such as:

int x = 1 + NULL;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133196 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix of a minor typo.
Jonathan D. Turner [Thu, 16 Jun 2011 20:47:21 +0000 (20:47 +0000)]
Fix of a minor typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133187 91177308-0d34-0410-b5e6-96231b3b80d8

13 years ago[arcmt] Fix test for MSVC build.
Argyrios Kyrtzidis [Thu, 16 Jun 2011 20:19:55 +0000 (20:19 +0000)]
[arcmt] Fix test for MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133183 91177308-0d34-0410-b5e6-96231b3b80d8