Daniel Dunbar [Tue, 28 Jun 2011 23:33:55 +0000 (23:33 +0000)]
Revert r133024, "[format strings] correctly suggest correct type for '%@'
specifiers. Fixes <rdar://problem/9607158>." because it causes false positives
on some code that uses CF toll free bridging.
- I'll let Doug or Ted figure out the right fix here, possibly just to accept
any pointer type.
Chandler Carruth [Tue, 28 Jun 2011 22:48:40 +0000 (22:48 +0000)]
Fix non-determinism in selecting between equal-length names which refer
to the same declaration when correcting typos. This is done by
essentially sorting the corrections as they're added.
Original patch by Kaelyn Uhrain, but modified for style and correctness
by accounting for more than just the textual spelling.
This still is a bit of a WIP hack to make this deterministic. Kaelyn
(and myself) are working on a more principled solution going forward.
Chad Rosier [Tue, 28 Jun 2011 22:29:53 +0000 (22:29 +0000)]
Modify test case to allow buildbots to make forward progress. This test should
now (incorrectly) pass. Once the appropriate fixes have been made this test
should be reverted.
Chris Lattner [Tue, 28 Jun 2011 05:11:33 +0000 (05:11 +0000)]
Fix PR9279 - Macro expansion stack trace seriously broken with function-style macros, by not recursively printing notes for other 'instantiated from' notes.
This is a one line fix here:
+ // Don't print recursive instantiation notes from an instantiation note.
+ Loc = SM.getSpellingLoc(Loc);
While here, fix the testcase to be more precise (it got filecheck'ized
brutally), and fix EmitCaretDiagnostic to be private and to not pass down
the unused 'Level' argument.
Eli Friedman [Mon, 27 Jun 2011 23:58:21 +0000 (23:58 +0000)]
Merge some calls to FoldingSetNodeID::AddInteger; assuming my measurements aren't completely off, roughly a 1% speedup on SingleSource/UnitTests/ObjC/trivial-interface.m .
Jordy Rose [Mon, 27 Jun 2011 20:36:38 +0000 (20:36 +0000)]
[analyzer] Use UnknownVal when default-initializing arrays whose element types we don't model, to distinguish them from uninitialized arrays (PR10163).
Douglas Gregor [Mon, 27 Jun 2011 18:45:19 +0000 (18:45 +0000)]
Reduce the size of the ExtInfo bitfield in FunctionType from 9 bits
down to 8 by restricting the maximum allowed regparm value to 6
(previously it was 7). I need the extra bit in Type to handle
instantiation-dependence.
Douglas Gregor [Mon, 27 Jun 2011 16:55:54 +0000 (16:55 +0000)]
When instantiating a C++ "new" expression, don't fake source locations
for the '(' and ')' around the initializer unless we actually have an
initializer. Fixes PR10197, an issue where we were value-initializing
rather than default-initializing.
Chandler Carruth [Mon, 27 Jun 2011 08:31:58 +0000 (08:31 +0000)]
Fix missing braces around two statements that were intended to be part
of a single if block. This is really annoying to track down and test.
Silly changes to the test case caused it to stop showing up. I wish
there were a more concrete way of asserting that a note attaches to the
intended diagnostic.
Chandler Carruth [Mon, 27 Jun 2011 08:02:19 +0000 (08:02 +0000)]
Factor out (some of) the checking for invalid forms of pointer
arithmetic into a couple of common routines. Use these to make the
messages more consistent in the various contexts, especially in terms of
consistently diagnosing binary operators with invalid types on both the
left- and right-hand side. Also, improve the grammar and wording of the
messages some, handling both two pointers and two (different) types.
The wording of function pointer arithmetic diagnostics still strikes me
as poorly phrased, and I worry this makes them slightly more awkward if
more consistent. I'm hoping to fix that with a follow-on patch and test
case that will also make them more helpful when a typedef or template
type parameter makes the type completely opaque.
Suggestions on better wording are very welcome, thanks to Richard Smith
for some initial help on that front.
Richard Smith [Sat, 25 Jun 2011 02:28:38 +0000 (02:28 +0000)]
Fix a couple more issues related to r133854:
When performing semantic analysis on a member declaration, fix the check for whether we are declaring a function to check for parenthesized declarators, declaration via decltype, etc.
Also fix the semantic check to not treat FuncType* as a function type.
John McCall [Sat, 25 Jun 2011 01:32:37 +0000 (01:32 +0000)]
Mark the multiply which occurs as part of performing pointer
arithmetic on a VLA as 'nsw', per discussion with djg, and
implement pointer arithmetic (other than array accesses) and
pointer subtraction for VLA types.
Douglas Gregor [Sat, 25 Jun 2011 00:56:27 +0000 (00:56 +0000)]
When deciding how to parse "= something" as part of a member
declaration, determine whether the declaration will end up declaring a
function using semantic criteria (e.g., it will have function type)
rather than purely syntactic criteria (e.g., it has the form of a
function declarator). Fixes <rdar://problem/9670557>.
objc-arc/mrc: Allow ns_returns_not_retained attribute on properties
to turn off warning on those properties which follow Cocoa naming
convention for retaining objects and yet they were not meant for
such purposes. Also, perform consistancy checking for declared
getters of such methods. // rdar://9636091
Bob Wilson [Fri, 24 Jun 2011 22:13:26 +0000 (22:13 +0000)]
Revert "Shorten some ARM builtin names by removing unnecessary "neon" prefix."
Sorry, this was a bad idea. Within clang these builtins are in a separate
"ARM" namespace, but the actual builtin names should clearly distinguish tha
they are target specific.
John McCall [Fri, 24 Jun 2011 21:55:10 +0000 (21:55 +0000)]
Change the IR-generation of VLAs so that we capture bounds,
not sizes; so that we use well-typed allocas; and so that we
properly recurse through the full set of variably-modified types.
Allow Lexer::getLocForEndOfToken to return the location just passed the macro instantiation
if the location given points at the last token of the macro instantiation.
SourceManager::isAtStartOfMacroInstantiation should check not only if the location
is at the first token but that the location's offset is not inside the token as well.
Sean Hunt [Fri, 24 Jun 2011 02:11:39 +0000 (02:11 +0000)]
This patch started as an attempt to fix up the horrid naming
conventions. I then discovered a typo in the using declaration bit in
LookupSpecialMember. This led to discovering [namespace.udecl]p15, which
clang implements incorrectly. Thus I've added a comment and implemented
the code consistently with the rest of clang - that is incorrectly.
And because I don't want to include tests of something incorrect, I've
ripped the test out.
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.