John McCall [Thu, 23 Jun 2011 21:18:31 +0000 (21:18 +0000)]
Apparently at some point in the past I forgot how 'continue'
works in a 'while(false)' loop. Simplify this code; it was
complicated only in anticipation of C++0x lambdas, and it can
become complicated again when those happen. :)
Eli Friedman [Thu, 23 Jun 2011 18:10:35 +0000 (18:10 +0000)]
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.
Dylan Noblesmith [Thu, 23 Jun 2011 12:20:57 +0000 (12:20 +0000)]
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.
Sean Hunt [Thu, 23 Jun 2011 01:21:01 +0000 (01:21 +0000)]
Fix a bunch of HTML compliance problems with LanguageExtensions.html
One weird thing is the addition of several <a name=""> tags where
previously there were id attributes on the <h3> tags. This is because
the id attribute must begin with a letter, not an underscore. The name
attribute is not so constrained, so links will continue to work.
Douglas Gregor [Thu, 23 Jun 2011 00:49:38 +0000 (00:49 +0000)]
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.
Andrew Trick [Wed, 22 Jun 2011 23:23:49 +0000 (23:23 +0000)]
lit support for REQUIRES: asserts.
Take #2. Don't piggyback on the existing config.build_mode. Instead,
define a new lit feature for each build feature we need (currently
just "asserts"). Teach both autoconf'd and cmake'd Makefiles to define
this feature within test/lit.site.cfg. This doesn't require any lit
harness changes and should be more robust across build systems.
Manuel Klimek [Wed, 22 Jun 2011 20:02:16 +0000 (20:02 +0000)]
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.
Douglas Gregor [Wed, 22 Jun 2011 18:41:08 +0000 (18:41 +0000)]
Fix the starting location of the Fix-It note for suspicious precedence
issues between a bitwise operator and a comparison operator. Fixes
<rdar://problem/9637759>.
Douglas Gregor [Wed, 22 Jun 2011 18:16:25 +0000 (18:16 +0000)]
When instantiating a function template declaration that was expressed
via a typedef of a function, make sure to synthesize parameter
declarations. Fixes PR9654 / <rdar://problem/9257497>.
Douglas Gregor [Wed, 22 Jun 2011 16:32:26 +0000 (16:32 +0000)]
Implement the C++0x move optimization for Automatic Reference Counting
objects, so that we steal the retain count of a temporary __strong
pointer (zeroing out that temporary), eliding a retain/release
pair. Addresses <rdar://problem/9364932>.
Douglas Gregor [Wed, 22 Jun 2011 16:12:01 +0000 (16:12 +0000)]
When binding a reference to an Automatic Reference Counting temporary,
retain/release the temporary object appropriately. Previously, we
would only perform the retain/release operations when the reference
would extend the lifetime of the temporary, but this does the wrong
thing across calls.
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.
John McCall [Wed, 22 Jun 2011 02:32:12 +0000 (02:32 +0000)]
Emit @finally blocks completely lazily instead of forcing their
existence by always threading an edge from the catchall. Not doing
this was previously causing a crash in the very extreme case where
neither the normal cleanup nor the EH catchall was actually reachable:
we would delete the catchall entry block, which would cause us to
delete the entry block of the finally cleanup as well because the
cleanup logic would merge the blocks, which in turn triggered an assert
because later blocks in the finally would still be using values from the
entry. Laziness turns out to be the most elegant solution to the problem.
Sean Hunt [Wed, 22 Jun 2011 02:25:26 +0000 (02:25 +0000)]
Avoid making assumption that this is either a CXXMethodDecl or a
FunctionTemplateDecl. I'm not quite sure what else it could be, though,
and would appreciate some insight.
Sean Hunt [Wed, 22 Jun 2011 01:05:16 +0000 (01:05 +0000)]
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.
John McCall [Wed, 22 Jun 2011 00:53:57 +0000 (00:53 +0000)]
It is possible to request the nonfragile ABI with -fobjc-abi-version=2;
respect that when deciding whether -objc-exceptions implies the
-fexceptions -cc1 option.
Sean Hunt [Tue, 21 Jun 2011 23:42:56 +0000 (23:42 +0000)]
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.
Chandler Carruth [Tue, 21 Jun 2011 23:04:18 +0000 (23:04 +0000)]
Revert r133526 which re-orders the suggestions for -Wparentheses on ?:
operators. There is a consistent design of having the "silence the
warning" option first.
Bob Wilson [Tue, 21 Jun 2011 21:53:08 +0000 (21:53 +0000)]
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.
Bob Wilson [Tue, 21 Jun 2011 21:12:29 +0000 (21:12 +0000)]
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".
Daniel Dunbar [Tue, 21 Jun 2011 20:55:11 +0000 (20:55 +0000)]
Driver/Darwin: When invoking the linker, automatically pass -object_path_lto so
that the linker has a place to put the temporary object file and can leave it
around (for the driver to clean up). This is important so that the object file
references in the debug info are preserved for possible use by dsymutil.
- <rdar://problem/8294279> executable has no debug symbols when compiled with LTO
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
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.
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.
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.
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>.
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.
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
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.)