Commit Graph

10168 Commits

Author SHA1 Message Date
Douglas Gregor 9e66af44ad Clean up and refactor ParseFunctionDeclarator to reduce code
repetition and better reflect the actual grammar, from John Freeman!

llvm-svn: 134417
2011-07-05 16:44:18 +00:00
Anders Carlsson 1052fd76ab Remove unused parameter from ActOnDeclarator.
llvm-svn: 134377
2011-07-04 16:28:17 +00:00
Eli Friedman ec485453b2 Reorganize builtins to separate out builtins which require MMX registers. No functional change.
llvm-svn: 134304
2011-07-02 01:53:37 +00:00
Argyrios Kyrtzidis 451ccc0892 Fix the warning that is emitted when an ownership attribute is applied incorrectly.
llvm-svn: 134278
2011-07-01 22:23:09 +00:00
Argyrios Kyrtzidis 7192a3b841 [ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
(NSString**)&x; // Casting as (__strong NSString**).

llvm-svn: 134275
2011-07-01 22:22:59 +00:00
Argyrios Kyrtzidis d8701b60f7 -Remove Sema::ActOnCastOfParenListExpr and move most of its functionality to
newly introduced Sema::BuildVectorLiteral.
-Make Sema::ActOnCastExpr handle a vector initializer both when the cast'ed expression
 is a ParenListExpr and when it is a ParenExpr.
-Ultimately make Sema::ActOnParenOrParenListExpr independent of what the cast type was.

llvm-svn: 134274
2011-07-01 22:22:54 +00:00
Argyrios Kyrtzidis 7451d1cd00 [ARC] When casting from a pointer to an objective-c object with known ownership, if the
cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type
to the cast type:

id x;
static_cast<NSString**>(&x); // Casting as (__strong NSString**).

This currently only works for C++ named casts, C casts to follow.

llvm-svn: 134273
2011-07-01 22:22:50 +00:00
Argyrios Kyrtzidis 774506918c Introduce Declarator::ObjCCatchContext, this will result in correct error for 'auto' in obj-c catch.
llvm-svn: 134271
2011-07-01 22:22:40 +00:00
Douglas Gregor 51189e0b51 Refactor AttributeList.h to use alphabetical order, from Caitlin Sadowski
llvm-svn: 134267
2011-07-01 22:04:06 +00:00
Richard Smith cd1c055528 Fix AST representations of alias-declarations which define tag types. Inside classes, the tag types need to have an associated access specifier, and inside function definitions, they need to be included in the declarations of the DeclStmt. These issues manifested as assertions during template instantiation, and also in a WIP constexpr patch.
llvm-svn: 134250
2011-07-01 19:46:12 +00:00
Douglas Gregor 3cc1581020 When we create a precompiled preamble, don't copy the
CompilerInvocation on the stack, because other objects (e.g., the
CompilerInstance) maintain an intrusive reference-counted pointer to
the CompilerInvocation. This doesn't matter in the normal case,
because we take back the CompilerInvocation. However, during crash
recovery, this leads to us trying to free an object on the stack, and
hilarity ensues. Fixes <rdar://problem/9652540>.

llvm-svn: 134245
2011-07-01 18:22:13 +00:00
Douglas Gregor 678d76c026 Introduce the notion of instantiation dependence into Clang's AST. A
type/expression/template argument/etc. is instantiation-dependent if
it somehow involves a template parameter, even if it doesn't meet the
requirements for the more common kinds of dependence (dependent type,
type-dependent expression, value-dependent expression).

When we see an instantiation-dependent type, we know we always need to
perform substitution into that instantiation-dependent type. This
keeps us from short-circuiting evaluation in places where we
shouldn't, and lets us properly implement C++0x [temp.type]p2.

In theory, this would also allow us to properly mangle
instantiation-dependent-but-not-dependent decltype types per the
Itanium C++ ABI, but we aren't quite there because we still mangle
based on the canonical type in cases like, e.g.,

  template<unsigned> struct A { };
  template<typename T>
    void f(A<sizeof(sizeof(decltype(T() + T())))>) { }
  template void f<int>(A<sizeof(sizeof(int))>);

and therefore get the wrong answer.

llvm-svn: 134225
2011-07-01 01:22:09 +00:00
Peter Collingbourne d395b9344d Replace an unreachable error path with an assert
(SourceManager::createFileID cannot return an invalid file ID).
Also update a comment to reflect this.

llvm-svn: 134168
2011-06-30 16:41:03 +00:00
Peter Collingbourne 400d7b9e08 Fix typo
llvm-svn: 134167
2011-06-30 16:40:50 +00:00
Chandler Carruth 1406d6c037 Improve the wording of the warning when returning a value from
a constructor or destructor.

Patch by Hans Wennborg.

llvm-svn: 134138
2011-06-30 08:56:22 +00:00
John McCall d9dfe3a1f8 Preserve that a TemplateName was arrived at by substituting
for a template template parameter.

Uses to follow.

I've also made the uniquing of SubstTemplateTemplateParmPacks
use a ContextualFoldingSet as a minor space efficiency.

llvm-svn: 134137
2011-06-30 08:33:18 +00:00
John McCall 8bdae58c3a Document and check tighter assumptions about the TemplateName of a
TemplateSpecializationType.

llvm-svn: 134120
2011-06-30 00:42:27 +00:00
Argyrios Kyrtzidis 8cc0459907 Introduce a caching mechanism for macro expanded tokens.
Previously macro expanded tokens were added to Preprocessor's bump allocator and never released,
even after the TokenLexer that were lexing them was finished, thus they were wasting memory.
A very "useful" boost library was causing clang to eat 1 GB just for the expanded macro tokens.

Introduce a special cache that works like a stack; a TokenLexer can add the macro expanded tokens
in the cache, and when it finishes, the tokens are removed from the end of the cache.

Now consumed memory by expanded tokens for that library is ~ 1.5 MB.

Part of rdar://9327049.

llvm-svn: 134105
2011-06-29 22:20:11 +00:00
Argyrios Kyrtzidis e379ee31c0 Introduce Preprocessor::getTotalMemory() and use it in CIndex.cpp, no functionality change.
llvm-svn: 134103
2011-06-29 22:20:04 +00:00
Fariborz Jahanian 25e61c58bf Use existing -fcatch-undefined-behavior option,
replacing -freset-local-blocks. // rdar://9227352

llvm-svn: 134082
2011-06-29 18:41:17 +00:00
David Chisnall 91f5b811ff Make ARC support default to true. Please can we stop making Objective-C runtime features part of the platform description? This only makes sense for Darwin.
llvm-svn: 134066
2011-06-29 13:17:23 +00:00
Fariborz Jahanian fc510bdd94 Under a compiler flag, -freset-local-blocks,
wipe out stack blocks when they go out of scope.
// rdar://9227352

llvm-svn: 134045
2011-06-28 23:51:26 +00:00
Eric Christopher fd9a5f4f66 Split out logic for valid clobbers and valid inline asm registers.
Fixes rdar://9281377

llvm-svn: 134016
2011-06-28 18:20:53 +00:00
Douglas Gregor c2fa169d6c Add support for C++ namespace-aware typo correction, e.g., correcting
vector<int>

to

  std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!

llvm-svn: 134007
2011-06-28 16:20:02 +00:00
Chris Lattner ac57f21cd1 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.

llvm-svn: 133993
2011-06-28 05:11:33 +00:00
Argyrios Kyrtzidis 3ff13579f9 Introduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameter
from Sema::GetTypeForDeclarator. No functionality change.

llvm-svn: 133987
2011-06-28 03:01:23 +00:00
Argyrios Kyrtzidis 7baa0af39b Centralize all checks for a C++ tag definition inside a typename in
Sema::GetTypeForDeclarator and remove its 'OwnedDecl' out parameter.

No functionality change.

llvm-svn: 133986
2011-06-28 03:01:18 +00:00
Fariborz Jahanian c297cd8836 Provide fix-it for '.' <-> '->' for Objective-C ivar/property access.
// rdar://7811841

llvm-svn: 133970
2011-06-28 00:00:52 +00:00
John McCall b8c604abfd Don't factor in visibility for templates and template arguments
for explicit specializations with their own explicit visibility.

llvm-svn: 133958
2011-06-27 23:06:04 +00:00
Eli Friedman cadd8eefdf Cache the result of AttributeList::getKind(); it's relatively expensive to compute, and we query it frequently enough that it showed up in a profile.
llvm-svn: 133948
2011-06-27 21:53:17 +00:00
Bob Wilson cbf87061d3 Minor grammatical fix for error message. Radar 9681093.
llvm-svn: 133934
2011-06-27 20:25:49 +00:00
Douglas Gregor db1ab7dccf 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.

llvm-svn: 133924
2011-06-27 18:45:19 +00:00
Chandler Carruth 4cc3f296a9 Cleanup a fixme by using a specific diagnostic for subscripting
a pointer to void.

llvm-svn: 133912
2011-06-27 16:32:27 +00:00
Chandler Carruth c933221826 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.

llvm-svn: 133906
2011-06-27 08:02:19 +00:00
Douglas Gregor c15b0cfc1f 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>.

llvm-svn: 133854
2011-06-25 00:56:27 +00:00
Fariborz Jahanian f4105f5cfe 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

llvm-svn: 133849
2011-06-25 00:17:46 +00:00
Bob Wilson 6bc2164d2a 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.

llvm-svn: 133833
2011-06-24 22:13:26 +00:00
Bob Wilson 932e5b5d52 Shorten some ARM builtin names by removing unnecessary "neon" prefix.
llvm-svn: 133826
2011-06-24 21:32:46 +00:00
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
Argyrios Kyrtzidis 90b6a2a6a7 [arcmt] Fix the ARC migrator. -arcmt-modify requires running before the initialization of SourceManager
because it is going to modify the input file.

llvm-svn: 133323
2011-06-18 00:53:41 +00:00
Argyrios Kyrtzidis 1240f4e53a [arcmt] Remove '-arcmt-modify-in-memory', it turned out less useful than we hoped it would be.
llvm-svn: 133315
2011-06-17 23:49:31 +00:00
John McCall 0c07bee8bd Only accept __bridge_retain in system headers, as Doug suggested.
llvm-svn: 133300
2011-06-17 21:56:12 +00:00
John McCall 0c32925aa0 As a hopefully temporary workaround for a header mistake, treat
__bridge_retain as a synonym for __bridge_retained.

llvm-svn: 133295
2011-06-17 21:23:37 +00:00
Richard Trieu fc51bc1cea 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.
llvm-svn: 133287
2011-06-17 20:35:48 +00:00
John McCall d463132f27 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.

llvm-svn: 133243
2011-06-17 06:42:21 +00:00
Douglas Gregor 84265a09d6 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.

llvm-svn: 133236
2011-06-17 05:09:08 +00:00
Douglas Gregor c976f01d3f 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.

llvm-svn: 133232
2011-06-17 03:41:35 +00:00
Eli Friedman 623e2ba435 Add support for -force_load flag, for compat with Apple gcc. rdar://9555962 .
llvm-svn: 133218
2011-06-16 23:59:43 +00:00
Francois Pichet ea22bab7a5 Finish 2 sentences.
llvm-svn: 133214
2011-06-16 23:19:36 +00:00
Chris Lattner 7531533950 comment improvements.
llvm-svn: 133213
2011-06-16 22:58:30 +00:00
Chris Lattner 0c64f4b27e code cleanups, no behavior change.
llvm-svn: 133211
2011-06-16 22:56:45 +00:00