Commit Graph

9761 Commits

Author SHA1 Message Date
Enea Zaffanella 28f36ba693 Avoid patching storage class for block scope thread_local variables.
llvm-svn: 181627
2013-05-10 20:34:44 +00:00
Richard Smith b8a98241fc PR15966: don't get confused by a complex integer -> complex integer conversion
and misclassify it as a complex-real conversion.

llvm-svn: 181626
2013-05-10 20:29:50 +00:00
Dmitri Gribenko be0221067d ArrayRef'ize Sema::FindAllocationFunctions
Patch by Robert Wilhelm.

llvm-svn: 181594
2013-05-10 13:22:23 +00:00
Dmitri Gribenko 8236037d47 ArrayRef'ize GenericSelectionExpr
llvm-svn: 181592
2013-05-10 13:06:58 +00:00
Hans Wennborg 0d81e01916 Add support for __wchar_t in -fms-extensions mode.
MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.

The commit changes ASTContext to have two different types for this:

  - WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.

  - WideCharTy is the type of a wide character literal. In C++ this is
    the same as WCharTy, and in C  it is an integer type compatible with
    the type in <stddef.h>.

This fixes PR15815.

llvm-svn: 181587
2013-05-10 10:08:40 +00:00
Richard Smith 7500ab2464 C++1y auto return type: when a function contains no 'return' statements at all,
substitute 'void' into the return type rather than replacing it with 'void', so
that we maintain the 'auto' type sugar.

llvm-svn: 181584
2013-05-10 04:31:10 +00:00
Dmitri Gribenko ea2d5f818b Remove redundant variable
llvm-svn: 181574
2013-05-10 01:14:26 +00:00
Dmitri Gribenko 2a40f0848e ArrayRef'ize Sema::CheckMessageArgumentTypes
llvm-svn: 181571
2013-05-10 00:27:15 +00:00
Dmitri Gribenko 08c8668dbd ArrayRef'ize Sema::FindAllocationOverload
Now tests should pass.  The previous error was caused by a misplaced backing
array for MutableArrayRef that I introduced.

llvm-svn: 181570
2013-05-10 00:20:06 +00:00
Dmitri Gribenko d95656e0b5 Revert my r181563, breaks tests on buildbots
llvm-svn: 181568
2013-05-10 00:11:18 +00:00
Dmitri Gribenko 139474d498 ArrayRef'ize Sema::ActOnMemInitializer
llvm-svn: 181565
2013-05-09 23:51:52 +00:00
Dmitri Gribenko 85378316bf ArrayRef'ize Sema::FindAllocationOverload
llvm-svn: 181563
2013-05-09 23:45:53 +00:00
Dmitri Gribenko d3b75560aa ArrayRef'ize Sema::BuildCallToObjectOfClassType
llvm-svn: 181562
2013-05-09 23:32:58 +00:00
Richard Smith 21b3ab43e1 C++1y n3648: parse and reject init-captures for now.
llvm-svn: 181553
2013-05-09 21:36:41 +00:00
Dmitri Gribenko 9c785c217b ArrayRef'ize some SemaOverload methods
Patch by Robert Wilhelm.

llvm-svn: 181544
2013-05-09 21:02:07 +00:00
Ben Langmuir 3b4c30b7e7 CodeGen for CapturedStmts
EmitCapturedStmt creates a captured struct containing all of the captured
variables, and then emits a call to the outlined function.  This is similar in
principle to EmitBlockLiteral.

GenerateCapturedFunction actually produces the outlined function.  It is based
on GenerateBlockFunction, but is much simpler.  The function type is determined
by the parameters that are in the CapturedDecl.

Some changes have been added to this patch that were reviewed as part of the
serialization patch and moving the parameters to the captured decl.

Differential Revision: http://llvm-reviews.chandlerc.com/D640

llvm-svn: 181536
2013-05-09 19:17:11 +00:00
Reid Kleckner e43f0fea15 Forward #pragma comment(lib/linker) through as flags metadata
Summary:
Most of this change is wiring the pragma all the way through from the
lexer, parser, and sema to codegen.  I considered adding a Decl AST node
for this, but it seemed too heavyweight.

Mach-O already uses a metadata flag called "Linker Options" to do this
kind of auto-linking.  This change follows that pattern.

LLVM knows how to forward the "Linker Options" metadata into the COFF
.drectve section where these flags belong.  ELF support is not
implemented, but possible.

This is related to auto-linking, which is http://llvm.org/PR13016.

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D723

llvm-svn: 181426
2013-05-08 13:44:39 +00:00
John McCall 1b4259b53b In block enum-return inference, don't die on loads of enum lvalues.
More of rdar://13200889.

llvm-svn: 181390
2013-05-08 03:34:22 +00:00
Nick Lewycky d1b0df46f5 When typo correction produces an overloaded result when looking up a member,
return all the overloads instead of just picking the first possible declaration.
This removes an invalid note (and on occasion other invalid diagnostics) and
also makes clang's parsing recovery behave as if the text from its fixit were
applied.

llvm-svn: 181370
2013-05-07 22:14:37 +00:00
Argyrios Kyrtzidis c64c029f85 Try to recognise hidden tag type names in potential declarations, in ObjC code as well.
rdar://13829073

llvm-svn: 181345
2013-05-07 19:54:28 +00:00
Serge Pavlov 64bc7038a2 Test commit
llvm-svn: 181332
2013-05-07 16:56:03 +00:00
Richard Smith 99005e65cd C++1y: an assignment operator is implicitly 'constexpr' if it would only call 'constexpr' assignment operators for a literal class type.
llvm-svn: 181284
2013-05-07 03:19:20 +00:00
John McCall d25db7ed0f Grab-bag of bit-field fixes:
- References to ObjC bit-field ivars are bit-field lvalues;
    fixes rdar://13794269, which got me started down this.
  - Introduce Expr::refersToBitField, switch a couple users to
    it where semantically important, and comment the difference
    between this and the existing API.
  - Discourage Expr::getBitField by making it a bit longer and
    less general-sounding.
  - Lock down on const_casts of bit-field gl-values until we
    hear back from the committee as to whether they're allowed.

llvm-svn: 181252
2013-05-06 21:39:12 +00:00
Richard Smith 252a0acce2 Add missing initialization for Sema::CurScope. This is important for AST consumers which don't create a Parser. Pointed out by Tom Honermann.
llvm-svn: 181251
2013-05-06 21:35:35 +00:00
Jordan Rose 6c0505e4eb Fix representation of compound literals for C++ objects with destructors.
Previously, this compound literal expression (a GNU extension in C++):

  (AggregateWithDtor){1, 2}

resulted in this AST:

 `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...])
   `-CompoundLiteralExpr [...] 'struct AggregateWithDtor'
     `-CXXBindTemporaryExpr [...] 'struct AggregateWithDtor' (CXXTemporary [...])
       `-InitListExpr [...] 'struct AggregateWithDtor'
         |-IntegerLiteral [...] 'int' 1
         `-IntegerLiteral [...] 'int' 2

Note the two CXXBindTemporaryExprs. The InitListExpr is really part of the
CompoundLiteralExpr, not an object in its own right. By introducing a new
entity initialization kind in Sema specifically for compound literals, we
avoid the treatment of the inner InitListExpr as a temporary.

 `-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...])
   `-CompoundLiteralExpr [...] 'struct AggregateWithDtor'
     `-InitListExpr [...] 'struct AggregateWithDtor'
       |-IntegerLiteral [...] 'int' 1
       `-IntegerLiteral [...] 'int' 2

llvm-svn: 181212
2013-05-06 16:48:12 +00:00
John McCall 768439eb2e Require the containing type to be complete when we see
__alignof__ of a field.

This problem can only happen in C++11.

Also do some petty optimizations.

rdar://13784901

llvm-svn: 181185
2013-05-06 07:40:34 +00:00
Richard Smith d74b1606a6 Fix assert if __extension__ or _Generic is used when initializing a char array from a string literal.
llvm-svn: 181174
2013-05-06 00:35:47 +00:00
Dmitri Gribenko 78852e91c8 Replace 'MultiExprArg()' with 'None'
llvm-svn: 181166
2013-05-05 20:40:26 +00:00
Rafael Espindola 593537a979 Make all 'is in extern "C"' tests use the lexical context.
I was not able to find a case (other than the fix in r181163) where this
makes a difference, but it is a more obviously correct API to have.

llvm-svn: 181165
2013-05-05 20:15:21 +00:00
Dmitri Gribenko 1debc468fa ArrayRef'ize Sema::CheckObjCMethodCall
Patch by Robert Wilhelm.

llvm-svn: 181164
2013-05-05 19:42:09 +00:00
Rafael Espindola a5d5220497 Use lexical contexts when checking for conflicting language linkages.
This fixes pr14958. I will audit other calls to isExternCContext to see
if there are any similar bugs left.

llvm-svn: 181163
2013-05-05 18:24:05 +00:00
Richard Smith 430c23bb42 Handle parens properly when initializing a char array from a string literal.
llvm-svn: 181159
2013-05-05 16:40:13 +00:00
Richard Smith e54c307bb4 ArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!
llvm-svn: 181158
2013-05-05 15:51:06 +00:00
Dmitri Gribenko 44ebbd5436 Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef constructor from None
Patch by Robert Wilhelm.

llvm-svn: 181139
2013-05-05 00:41:58 +00:00
Enea Zaffanella acb8ecd664 In VarDecl nodes, store the thread storage class specifier as written.
llvm-svn: 181113
2013-05-04 08:27:07 +00:00
Richard Smith 2a7d481faf Implement most of N3638 (return type deduction for normal functions).
Missing (somewhat ironically) is support for the new deduction rules
in lambda functions, plus PCH support for return type patching.

llvm-svn: 181108
2013-05-04 07:00:32 +00:00
Richard Smith 22262abd78 Don't build a call expression referring to a function which we're not allowed
to use. This makes very little difference right now (other than suppressing
follow-on errors in some cases), but will matter more once we support deduced
return types (we don't want expressions with undeduced return types in the
AST).

llvm-svn: 181107
2013-05-04 06:44:46 +00:00
Richard Smith 489e4e0369 Say 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction diagnostic.
llvm-svn: 181103
2013-05-04 04:19:27 +00:00
Wei Pan 17fbf6edc2 Implement template support for CapturedStmt
- Sema tests added and CodeGen tests are pending

Differential Revision: http://llvm-reviews.chandlerc.com/D728

llvm-svn: 181101
2013-05-04 03:59:06 +00:00
Richard Smith b875c43307 Simplify slightly.
llvm-svn: 181092
2013-05-04 01:51:08 +00:00
Richard Smith 01518fa77a Separate out and special-case the diagnostic for 'auto' in a
conversion-type-id, in preparation for this becoming valid in c++1y mode.
No functionality change; small diagnostic improvement.

llvm-svn: 181089
2013-05-04 01:26:46 +00:00
Richard Smith 47752e489e ArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!
llvm-svn: 181077
2013-05-03 23:46:09 +00:00
Argyrios Kyrtzidis 56c56d218d Revert r177218.
Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag.

llvm-svn: 181073
2013-05-03 23:20:27 +00:00
Wei Pan c4c76d1b4f Test commit
llvm-svn: 181057
2013-05-03 21:07:45 +00:00
Richard Smith fa11fd669f PR15906: The body of a lambda is not an evaluated subexpression; don't visit it when visiting such subexpressions.
llvm-svn: 181046
2013-05-03 19:16:22 +00:00
Ben Langmuir 37943a7af8 Move CapturedStmt parameters to CapturedDecl
Move the creation of CapturedStmt parameters out of CodeGen and into
Sema, making it easier to customize the outlined function. The
ImplicitParamDecls are stored in the CapturedDecl using an
ASTContext-allocated array.

Differential Revision: http://llvm-reviews.chandlerc.com/D722

llvm-svn: 181043
2013-05-03 19:00:33 +00:00
Argyrios Kyrtzidis fac3162022 Keep track of an @implementation's super class name location, if one was provided.
llvm-svn: 181039
2013-05-03 18:05:44 +00:00
Dmitri Gribenko 8f8930fc01 ArrayRef'ize InitializationSequence constructor and InitializationSequence::Diagnose()
Patch by Robert Wilhelm.

llvm-svn: 181022
2013-05-03 15:05:50 +00:00
Dmitri Gribenko 5267fdfb7f Add const qualifier to Sema::getTypeName's parameter `II`
Patch by Ismail Pazarbasi.

llvm-svn: 181011
2013-05-03 13:12:11 +00:00
John McCall dec348f7db Correctly emit certain implicit references to 'self' even within
a lambda.

Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation
functions.  Fix that by generally improving getNonClosureContext
to look through lambdas and captured statements but only report
code contexts, which is generally what's wanted.  Audit uses of
CurFuncDecl and getNonClosureAncestor for correctness.

Bug #2 is that lambdas weren't specially mapping 'self' when inside
an ObjC method.  Fix that by removing the requirement for that
and using the normal EmitDeclRefLValue path in LoadObjCSelf.

rdar://13800041

llvm-svn: 181000
2013-05-03 07:33:41 +00:00