summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Fix representation of compound literals for C++ objects with destructors.Jordan Rose2013-05-062-6/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Require the containing type to be complete when we seeJohn McCall2013-05-061-19/+54
| | | | | | | | | | | | __alignof__ of a field. This problem can only happen in C++11. Also do some petty optimizations. rdar://13784901 llvm-svn: 181185
* Fix assert if __extension__ or _Generic is used when initializing a char ↵Richard Smith2013-05-061-4/+11
| | | | | | array from a string literal. llvm-svn: 181174
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-059-34/+33
| | | | llvm-svn: 181166
* Make all 'is in extern "C"' tests use the lexical context.Rafael Espindola2013-05-051-5/+3
| | | | | | | 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
* ArrayRef'ize Sema::CheckObjCMethodCallDmitri Gribenko2013-05-052-4/+4
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181164
* Use lexical contexts when checking for conflicting language linkages.Rafael Espindola2013-05-051-2/+2
| | | | | | | This fixes pr14958. I will audit other calls to isExternCContext to see if there are any similar bugs left. llvm-svn: 181163
* Handle parens properly when initializing a char array from a string literal.Richard Smith2013-05-051-3/+14
| | | | llvm-svn: 181159
* ArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!Richard Smith2013-05-052-118/+99
| | | | llvm-svn: 181158
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-0511-42/+28
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* In VarDecl nodes, store the thread storage class specifier as written.Enea Zaffanella2013-05-042-4/+2
| | | | llvm-svn: 181113
* Implement most of N3638 (return type deduction for normal functions).Richard Smith2013-05-047-34/+250
| | | | | | | Missing (somewhat ironically) is support for the new deduction rules in lambda functions, plus PCH support for return type patching. llvm-svn: 181108
* Don't build a call expression referring to a function which we're not allowedRichard Smith2013-05-043-18/+37
| | | | | | | | | 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
* Say 'decltype(auto)' not 'auto' as appropriate in mismatched-deduction ↵Richard Smith2013-05-041-0/+1
| | | | | | diagnostic. llvm-svn: 181103
* Implement template support for CapturedStmtWei Pan2013-05-042-7/+21
| | | | | | | | - Sema tests added and CodeGen tests are pending Differential Revision: http://llvm-reviews.chandlerc.com/D728 llvm-svn: 181101
* Simplify slightly.Richard Smith2013-05-041-4/+4
| | | | llvm-svn: 181092
* Separate out and special-case the diagnostic for 'auto' in aRichard Smith2013-05-041-6/+15
| | | | | | | conversion-type-id, in preparation for this becoming valid in c++1y mode. No functionality change; small diagnostic improvement. llvm-svn: 181089
* ArrayRef'ize MultiLevelTemplateArgumentList::ArgList. Patch by Faisal Vali!Richard Smith2013-05-032-20/+14
| | | | llvm-svn: 181077
* Revert r177218.Argyrios Kyrtzidis2013-05-031-7/+0
| | | | | | Per discussion in cfe-commits, asserting may be a better way than introducing a special test flag. llvm-svn: 181073
* Test commitWei Pan2013-05-031-1/+1
| | | | llvm-svn: 181057
* PR15906: The body of a lambda is not an evaluated subexpression; don't visit ↵Richard Smith2013-05-031-1/+1
| | | | | | it when visiting such subexpressions. llvm-svn: 181046
* Move CapturedStmt parameters to CapturedDeclBen Langmuir2013-05-032-7/+18
| | | | | | | | | | | 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
* Keep track of an @implementation's super class name location, if one was ↵Argyrios Kyrtzidis2013-05-031-1/+1
| | | | | | provided. llvm-svn: 181039
* ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko2013-05-039-176/+132
| | | | | | | | InitializationSequence::Diagnose() Patch by Robert Wilhelm. llvm-svn: 181022
* Add const qualifier to Sema::getTypeName's parameter `II`Dmitri Gribenko2013-05-031-1/+1
| | | | | | Patch by Ismail Pazarbasi. llvm-svn: 181011
* Correctly emit certain implicit references to 'self' even withinJohn McCall2013-05-031-1/+1
| | | | | | | | | | | | | | | | | | 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
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-038-313/+123
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. llvm-svn: 180973
* Revert r180970; it's causing breakage.Douglas Gregor2013-05-021-2/+2
| | | | llvm-svn: 180972
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. llvm-svn: 180970
* Fix crasher when the range in a C++ range-for loop has an ill-formed ↵Douglas Gregor2013-05-021-2/+11
| | | | | | | | initializer. Fixes <rdar://problem/13712739>. llvm-svn: 180937
* PR15884: In the 'taking the address of a temporary' extension, materialize theRichard Smith2013-05-011-0/+3
| | | | | | | | temporary to an lvalue before taking its address. This removes a weird special case from the AST representation, and allows the constant expression evaluator to deal with it without (broken) hacks. llvm-svn: 180866
* Point diagnostics that complain about a use of a selector in an objc ↵Argyrios Kyrtzidis2013-05-011-24/+41
| | | | | | | | | | | | message, to the selector location. Previously it would point to the left bracket or the receiver, which can be particularly problematic if the receiver is a block literal and we end up point the diagnostic far away for the selector that is complaining about. rdar://13620447 llvm-svn: 180833
* Fix PR15845: apparently MSVC does not support implicit int in C++ mode.Richard Smith2013-04-302-5/+2
| | | | llvm-svn: 180822
* When deducing an 'auto' type, don't modify the type-as-written.Richard Smith2013-04-304-52/+45
| | | | llvm-svn: 180808
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-307-105/+107
| | | | | | | | are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. llvm-svn: 180789
* Fix very confusing indent in Sema.cpp.Daniel Jasper2013-04-301-6/+5
| | | | | | | This came up during my Euro LLVM 2013 talk on clang-format and I was asked to submit it :-). llvm-svn: 180772
* Objective-C (mostly arc): Under ARC, we often have unneeded qualifiers Fariborz Jahanian2013-04-301-0/+4
| | | | | | | in the diagnostics. Remove them when reporting incompatible Objective-C pointer types. // rdar://13752880. llvm-svn: 180765
* c language: diagnose use of "[*]" on any array dimensionFariborz Jahanian2013-04-291-1/+3
| | | | | | | | in the parameter of a function definition. Currently, it crashes in irgen if it is on other than the 1st dimension. // rdar://13705391 llvm-svn: 180732
* Use ArrayRef in AddMethodCandidate.Rafael Espindola2013-04-291-6/+9
| | | | | | Patch by Robert Wilhelm! llvm-svn: 180724
* Small CapturedStmt improvementsBen Langmuir2013-04-293-24/+19
| | | | | | | | | | | | | Add a CapturedStmt.h similar to Lambda.h to reduce the typing required to get to the CapturedRegionKind enum. This also allows codegen to access this enum without including Sema/ScopeInfo.h. Also removes some duplicated code for capturing 'this' between CapturedStmt and Lambda. Differential Revision: http://llvm-reviews.chandlerc.com/D712 llvm-svn: 180710
* Test commitBen Langmuir2013-04-291-1/+1
| | | | llvm-svn: 180709
* Implement DR580: access checks for template parameters of a class template areRichard Smith2013-04-291-9/+9
| | | | | | performed within the context of that class template. Patch by Ismail Pazarbasi! llvm-svn: 180707
* Fix an assertion failure / accepts-invalid in -fms-extensions mode. Don't buildRichard Smith2013-04-291-8/+10
| | | | | | | | | a dependent-scope id expression when a templated member function of a non-templated class references an unknown identifier, since instantiation won't rebuild it (and we can tell at parse time that it'll never work). Based on a patch by Faisal Vali! llvm-svn: 180701
* ArrayRef'ize Sema::ActOnEnumBody. No functionality change.Dmitri Gribenko2013-04-272-10/+10
| | | | | | Patch by Robert Wilhelm. llvm-svn: 180682
* Silence a silly sign compare warning from GCC.Benjamin Kramer2013-04-271-1/+1
| | | | llvm-svn: 180673
* Fix an assertion hit in Sema::CheckObjCMethodOverrides.Argyrios Kyrtzidis2013-04-271-4/+6
| | | | llvm-svn: 180651
* Implement C++1y decltype(auto).Richard Smith2013-04-267-25/+131
| | | | llvm-svn: 180610
* C++1y: support simple variable assignments in constexpr functions.Richard Smith2013-04-262-5/+7
| | | | llvm-svn: 180603
* Add r180263 back, but fix hasBraces() to be correct during parsing.Rafael Espindola2013-04-261-1/+2
| | | | | | | | Original commit message: Fix a case in linkage computation that should check for single line extern "C". llvm-svn: 180591
OpenPOWER on IntegriCloud