Commit Graph

10010 Commits

Author SHA1 Message Date
Fariborz Jahanian 0080fb5a18 This patch removes unused parameter allProperties and converts remaining
parameters in ArrayRef'ize Sema::ActOnAtEnd  to ArrayRef.
Patch by Robert Wilhelm.

llvm-svn: 186421
2013-07-16 15:33:19 +00:00
Tim Northover 6aacd49094 ARM: implement low-level intrinsics for the atomic exclusive operations.
This adds three overloaded intrinsics to Clang:
    T __builtin_arm_ldrex(const volatile T *addr)
    int __builtin_arm_strex(T val, volatile T *addr)
    void __builtin_arm_clrex()

The intent is that these do what users would expect when given most sensible
types. Currently, "sensible" translates to ints, floats and pointers.

llvm-svn: 186394
2013-07-16 09:47:53 +00:00
Eli Friedman e7b8aa9417 Merge attributes on typedef decls.
Not completely sure this is right, but it's clearly better than what
we did before this commit (effectively dropping the attribute).

<rdar://problem/14413117>

llvm-svn: 186373
2013-07-16 02:07:49 +00:00
Eli Friedman cccd06487d Fix member refs with using decl + anonymous union.
Make sure we call BuildFieldReferenceExpr with the appropriate decl
when a member of an anonymous union is made public with a using decl.
Also, fix a crash on invalid field access into an anonymous union.

Fixes PR16630.

llvm-svn: 186367
2013-07-16 00:01:31 +00:00
Kaelyn Uhrain bad7fb09b2 Move the "->" to "." fixit from r186128 into a separate note since
recovery is not attempted with the fixit. Also move the associated test
case from FixIt/fixit.cpp to SemaCXX/member-expr.cpp since the fixit is
no longer automatically applied.

llvm-svn: 186342
2013-07-15 19:54:54 +00:00
Chandler Carruth 9324d169bd Re-revert r86040, which was un-reverted in r186199.
This breaks the build of basic patterns with repeated friend
declarations. See the added test case in SemaCXX/friend.cpp or the test
case reported to the original commit log.

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186331
2013-07-15 17:27:42 +00:00
Craig Topper d6d31aceea Add 'static' and 'const' qualifiers to some arrays of strings.
llvm-svn: 186314
2013-07-15 08:24:27 +00:00
Serge Pavlov 7cd8f6020f Fix to PR12262 - assertion when substituting explicit template arguments
does not substitute a sizeof-pack expression.
The solution is proposed by Richard Smith.
Differential Revision: http://llvm-reviews.chandlerc.com/D869

llvm-svn: 186306
2013-07-15 06:14:07 +00:00
Craig Topper e5ce831c7c Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).
llvm-svn: 186300
2013-07-15 03:38:40 +00:00
Craig Topper fa159c144a Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector size.
llvm-svn: 186284
2013-07-14 16:47:36 +00:00
Richard Smith 42713d763f If an unimported submodule of an imported module contains a declaration of a
global allocation or deallocation function, that should not cause that global
allocation or deallocation function to become unavailable.

llvm-svn: 186270
2013-07-14 02:01:48 +00:00
David Blaikie 48ad6dc463 PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to emit the full definition of a type in -flimit-debug-info
This simplifies the core benefit of -flimit-debug-info by taking a more
systematic approach to avoid emitting debug info definitions for types
that only require declarations. The previous ad-hoc approach (3 cases
removed in this patch) had many holes.

The general approach (adding a bit to TagDecl and callback through
ASTConsumer) has been discussed with Richard Smith - though always open
to revision.

llvm-svn: 186262
2013-07-13 21:08:14 +00:00
Richard Smith 141942fcca Unrevert r186040, reverted in r186185, with fix for PR16597.
Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186199
2013-07-12 20:38:49 +00:00
Chandler Carruth 9bdd1bb403 Revert r186040 to fix PR16597 while Richard investigates what the best
fix is.

Original commit log:
  If we friend a declaration twice, that should not make it visible to
  name lookup in the surrounding context. Slightly rework how we handle
  friend declarations to inherit the visibility of the prior
  declaration, rather than setting a friend declaration to be visible
  whenever there was a prior declaration.

llvm-svn: 186185
2013-07-12 18:54:40 +00:00
Eli Friedman 84c0143ea0 Fix crash on zero-argument assignment operator.
Make sure we don't crash when checking whether an assignment operator
without any arguments is a special member.  <rdar://problem/14397774>.

llvm-svn: 186137
2013-07-11 23:55:07 +00:00
Kaelyn Uhrain 1bb5dbf628 Provide a fixit hint for changing '->' to '.' if there is no operator->
defined for a class.

llvm-svn: 186128
2013-07-11 22:38:30 +00:00
Fariborz Jahanian 14e9541916 Restore warning to its original text when
certain familiy of methods have the wrong type.
// rdar://14408244

llvm-svn: 186111
2013-07-11 19:13:34 +00:00
Fariborz Jahanian b248ca5548 ObjectiveC arc[qoi]: When due to change of certain methods'
result type, a diagnostic being issued, issue a 'note' 
mentioning reason behind the unexpected warning.
// rdar://14121570.

llvm-svn: 186105
2013-07-11 16:48:06 +00:00
Richard Smith 6cbd65d84d Add a __builtin_addressof that performs the same functionality as the built-in
& operator (ignoring any overloaded operator& for the type). The purpose of
this builtin is for use in std::addressof, to allow it to be made constexpr;
the existing implementation technique (reinterpret_cast to some reference type,
take address, reinterpert_cast back) does not permit this because
reinterpret_cast between reference types is not permitted in a constant
expression in C++11 onwards.

llvm-svn: 186053
2013-07-11 02:27:57 +00:00
Richard Smith af9de91fd2 Make CheckAddressOfOperand a member of Sema so it can be reused by
__builtin_addressof.

llvm-svn: 186052
2013-07-11 02:26:56 +00:00
Richard Smith 7a73449b31 If we friend a declaration twice, that should not make it visible to name
lookup in the surrounding context. Slightly rework how we handle friend
declarations to inherit the visibility of the prior declaration, rather
than setting a friend declaration to be visible whenever there was a prior
declaration.

llvm-svn: 186040
2013-07-10 22:04:13 +00:00
Kaelyn Uhrain 8ec9f5f60e Offer typo suggestions for 'using' declarations.
Patch courtesy of Luke Zarko <zarko@google.com>

llvm-svn: 186019
2013-07-10 17:34:22 +00:00
Serge Pavlov ed5fe90bb8 Fixed comment of Sema::FindInstantiatedDecl.
llvm-svn: 185997
2013-07-10 04:59:14 +00:00
Eli Friedman 3b7d46c3ae More local mangling fixes.
Compute mangling numbers for externally visible local variables and tags.
Change the mangler to consistently use discriminators where necessary.
Tweak the scheme we use to number decls which are not externally visible
to avoid unnecessary discriminators in common cases now that we request
them more consistently.

Fixes <rdar://problem/14204721>.

llvm-svn: 185986
2013-07-10 00:30:46 +00:00
Fariborz Jahanian db4fc28145 Objective-C: merge objc_requires_super attribute of
method declaration into its implementation to
prevent a bogus warning about mismatched attributes.
then make sure the warning about missing call to super comes out
of the method implementation. // rdar://14251387

llvm-svn: 185974
2013-07-09 22:02:20 +00:00
Rafael Espindola ab417699dd ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup and
Sema::ActOnDocumentableDecls.

Patch by Robert Wilhelm.

llvm-svn: 185931
2013-07-09 12:05:01 +00:00
Eli Friedman 999af7bf6e Fix recovery for missing * in objc property.
<rdar://problem/14354144>

llvm-svn: 185897
2013-07-09 01:38:07 +00:00
Eli Friedman 544c956b72 Fix crash typo-correcting dependent member func.
PR16561.

llvm-svn: 185887
2013-07-08 23:35:04 +00:00
Kaelyn Uhrain 476c823ec8 Attempt typo correction for function calls with the wrong number of arguments.
Combined with typo correction's new ability to apply global/absolute nested
name specifiers to possible corrections, cases such as in PR12287 where the
desired function is being shadowed by a lexically closer function with the
same name but a different number of parameters will now include a FixIt.

On a side note, since the test for this change caused
test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for
a single file, I've included a test case for exceeding the limit and added
some comments to both the original and part two of typo-correction.cpp
warning future editors of the files about the limit.

llvm-svn: 185881
2013-07-08 23:13:44 +00:00
Kaelyn Uhrain 53e721980b Make a couple of useful typo correction callbacks more widely available.
llvm-svn: 185880
2013-07-08 23:13:39 +00:00
Eli Friedman e6d3395d78 Fix Sema for compares with _Atomic vars.
Use UsualArithmeticConversions unconditionally in analysis of
comparisons and conditional operators: the method performs
the usual arithmetic conversions if both sides are arithmetic, and
usual unary conversions if they are not.  This is just a cleanup
for conditional operators; for comparisons, it fixes the issue that
we would try to check isArithmetic() on an atomic type.

Also, fix GetExprRange() in SemaChecking.cpp so it deals with variables
of atomic type correctly.

Fixes PR15537.

llvm-svn: 185857
2013-07-08 20:20:06 +00:00
Craig Topper 0a4e1f586c Introduce a typedef for the type of NewlyDeducedPacks to avoid repeating the small size of the inner SmallVector.
llvm-svn: 185789
2013-07-08 04:44:01 +00:00
Craig Topper 4b482ee0ef Remove 'else' after 'return'
llvm-svn: 185787
2013-07-08 04:24:47 +00:00
Craig Topper c1bbe8d6d2 Function argument formatting fixes. No functional change.
llvm-svn: 185786
2013-07-08 04:16:49 +00:00
Craig Topper 7965357ce4 Function argument formatting fixes.
llvm-svn: 185785
2013-07-08 04:13:06 +00:00
Craig Topper 61ac906bdd Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid specifying the vector size.
llvm-svn: 185784
2013-07-08 03:55:09 +00:00
David Majnemer ea5092a3b0 Sema: Do not merge new decls with invalid, old decls
Sema::MergeFunctionDecl attempts merging two decls even if the old decl
is invalid.  This can lead to interesting circumstances where we
successfully merge the decls but the result makes no sense.

Take the following for example:

template <typename T>
int main(void);

int main(void);

Sema will not consider these to be overloads of the same name because
main can't be overloaded, which means that this must be a redeclaration.

In this case the templated decl is compatible with the non-templated
decl allowing the Sema::CheckFunctionDeclaration machinery to move on
and do bizarre things like setting the previous decl of a non-templated
decl to a templated decl!

The way I see it, we should just bail from MergeFunctionDecl if the old
decl is invalid.

This fixes PR16531.

llvm-svn: 185779
2013-07-07 23:49:50 +00:00
Fariborz Jahanian ae26bb67f8 Objective-C: Warn when fast enumeration variable isn't used.
// rdar://14182680.

llvm-svn: 185762
2013-07-06 18:04:13 +00:00
Sylvestre Ledru 8e5d82e541 Remove some useless declarations (found by scan-build)
llvm-svn: 185752
2013-07-06 08:00:09 +00:00
David Majnemer 027f9c4026 Sema: Fix a crash when main is redeclared as a function-template.
This boils down to us sending invalid function decls to
CheckFunctionDeclaration becauswe we did not consider that CheckMain
could cause the decl to be invalid.  Instead, interogate the new decl's
main-validity and *then* send it over to get CheckFunctionDeclaration'd
if it was still valid after calling CheckMain.

llvm-svn: 185745
2013-07-06 02:13:46 +00:00
Craig Topper 5603df45df Use SmallVectorImpl& for function arguments instead of SmallVector.
llvm-svn: 185715
2013-07-05 19:34:19 +00:00
Fariborz Jahanian 873bae79ac Objective-C: diagnose when synthesizing an ivar of
abstract class type. // rdar://14261999

llvm-svn: 185710
2013-07-05 17:18:11 +00:00
David Majnemer 0f328447b6 Sema: Call IgnoreParens fewer times in CheckAddressOfOperand
llvm-svn: 185684
2013-07-05 06:23:33 +00:00
Craig Topper 79be4cdd2d Add typedefs for Densemaps containing SmallVectors to avoid repeating the SmallVector size when creating iterators for the DenseMap.
llvm-svn: 185682
2013-07-05 04:33:53 +00:00
Craig Topper af6bd1b87f Add a space between closing template '>' to unbreak build.
llvm-svn: 185611
2013-07-04 03:15:42 +00:00
Craig Topper 2341c0d3b2 Use SmallVectorImpl instead of SmallVector for iterators and references to avoid specifying the vector size unnecessarily.
llvm-svn: 185610
2013-07-04 03:08:24 +00:00
Richard Smith c87b938e17 Part of PR15673: If a function template has a default argument in which
substitution failed, report that as a substitution failure rather than
pretending that there was no default argument.

The test cases in PR15673 have exposed some pre-existing poor diagnostics here.

llvm-svn: 185604
2013-07-04 01:01:24 +00:00
Richard Trieu 949abc327d Improve -Wlogical-not-parentheses to catch when the not is applied to an enum.
llvm-svn: 185602
2013-07-04 00:50:18 +00:00
Roman Divacky ac6f5f4015 Check LongDoubleFormat instead of just Width as this is PowerPC specific.
llvm-svn: 185584
2013-07-03 21:08:41 +00:00
Bill Schmidt 99a084b7ae "bool" should be a context-sensitive keyword in Altivec mode.
PR16456 reported that Clang implements a hybrid between AltiVec's
"Keyword and Predefine Method" and its "Context Sensitive Keyword
Method," where "bool" is always a keyword, but "vector" and "pixel"
are context-sensitive keywords.  This isn't permitted by the AltiVec
spec.  For consistency with gcc, this patch implements the Context
Sensitive Keyword Method for bool, and stops treating true and false
as keywords in Altivec mode.

The patch removes KEYALTIVEC as a trigger for defining these keywords
in include/clang/Basic/TokenKinds.def, and adds logic for "vector
bool" that mirrors the existing logic for "vector pixel."  The test
case is taken from the bug report.

llvm-svn: 185580
2013-07-03 20:54:09 +00:00