summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Objective-C: This is a small modification to myFariborz Jahanian2013-04-251-2/+2
| | | | | | | | | | patch -n r180198. When reporting on missing property accessor implementation in categories, do not report when they are declared in primary class, class's protocol, or one of it super classes or in of the other categories. // rdar://13713098 llvm-svn: 180580
* Put friend decls in the correct context.Rafael Espindola2013-04-251-15/+25
| | | | | | | | | | When we find a friend declaration we have to skip transparent contexts for doing lookups, but we should not skip them when inserting the new decl if the lookup found nothing. Fixes PR15841. llvm-svn: 180571
* Don't mark 'extern "C" void f(void)' as having extern storage class.Rafael Espindola2013-04-251-10/+16
| | | | | | | | | | Instead, we check for one line extern "C" context in linkage computation and when deciding if a variable is a definition. This hopefully completes the transition to having "as written" semantics for hasExternalStorage. llvm-svn: 180258
* Objective-C arc: Improve disgnostics when 'weak'Fariborz Jahanian2013-04-241-2/+4
| | | | | | | | property cannot be synthesized because its backing ivar does not support weak references. // rdar://13676793 llvm-svn: 180211
* Objective-C: When reporting on missing property accessor implementation inFariborz Jahanian2013-04-242-17/+37
| | | | | | | | categories, do not report when they are declared in primary class, class's protocol, or one of it super classes. This is because, its class is going to implement them. // rdar://13713098 llvm-svn: 180198
* When modifying an implicit instantiation with information from an explicit ↵Argyrios Kyrtzidis2013-04-221-0/+1
| | | | | | | | | | one, make sure to reset the "right brace" location. Otherwise the source range of the explicit instantiation may become invalid (begin location will be after the end location). rdar://13706991 llvm-svn: 180070
* Add a warning for Objective-C pointer introspection, which is solely the job ↵Ted Kremenek2013-04-221-0/+31
| | | | | | of the Objective-C runtime. llvm-svn: 180062
* [ms-inline asm] Set the OpDecl to the InlineAsmIdentifierInfo struct.Chad Rosier2013-04-221-0/+1
| | | | | | Part of rdar://13663589 llvm-svn: 180055
* [ms-inline asm] Refactor/clean up the SemaLookup interface. No functionalChad Rosier2013-04-221-23/+13
| | | | | | | change indended. Part of rdar://13663589 llvm-svn: 180027
* C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith2013-04-224-53/+205
| | | | | | | | statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. llvm-svn: 180022
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-211-2/+17
| | | | | | | | | C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. llvm-svn: 179969
* Disable VLA diagnostic in C++1y mode, and add some tests.Richard Smith2013-04-202-1/+6
| | | | | | | | | | | | Still to do here: - we have a collection of syntactic accepts-invalids to diagnose - support non-PODs in VLAs, including dynamic initialization / destruction - runtime checks (and throw std::bad_array_length) for bad bound - support VLA capture by reference in lambdas - properly support VLAs in range-based for (don't recompute bound) llvm-svn: 179962
* C++1y: Allow aggregates to have default initializers.Richard Smith2013-04-204-14/+86
| | | | | | | | | | | Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. llvm-svn: 179958
* Implement core issue 1608: class members can be found via operator lookup in ↵Richard Smith2013-04-201-6/+8
| | | | | | a trailing return type in that class's body. llvm-svn: 179941
* [ms-inline asm] The parsing of C++ identifiers is a task of the front-end ↵Chad Rosier2013-04-191-0/+31
| | | | | | | | | | parser, not the asm parser. As such, begin moving the parsing logic in that direction. This patch is just a temporary hack until the real frontend parser can be hooked up. Part of rdar://13663589 llvm-svn: 179882
* Specify that we're parsing ms-style inline assembly.Chad Rosier2013-04-181-1/+1
| | | | llvm-svn: 179762
* Switch the note order for -Woverloaded-shift-op-parentheses so that the noteRichard Trieu2013-04-181-4/+4
| | | | | | | with the silence fix-it comes first. This is more consistent with the rest of the warnings in -Wparentheses. llvm-svn: 179742
* PR15755: don't drop parameter packs when dropping parameters with defaultRichard Smith2013-04-171-7/+10
| | | | | | arguments in the formation of a candidate set of inheriting constructors. llvm-svn: 179708
* Sema: Remove unused variable.Benjamin Kramer2013-04-171-4/+0
| | | | llvm-svn: 179701
* DR974: Lambdas can have default arguments.Richard Smith2013-04-171-12/+2
| | | | llvm-svn: 179688
* Fix PR15291: noreturn adjustment in overload resolution for function ↵Douglas Gregor2013-04-172-21/+79
| | | | | | templates, from Alexander Zinenko! llvm-svn: 179680
* Add warning group -Woverloaded-shift-op-parentheses to -Wparentheses. ThisRichard Trieu2013-04-171-0/+32
| | | | | | | | | | | | | | | will fire on code such as: cout << x == 0; which the compiler will intrepret as (cout << x) == 0; This warning comes with two fixits attached to notes, one for parentheses to silence the warning, and another to evaluate the comparison first. llvm-svn: 179662
* Use the extra info in global method pool to speed up looking for ObjC ↵Argyrios Kyrtzidis2013-04-171-4/+40
| | | | | | | | | | | | | | | | | | overridden methods. When we are in a implementation, we check the global method pool whether there were category methods with the same selector. If there were none (common case) we don't need to do lookups for overridden methods again. Note that for an interface method (if we don't encounter its implementation), it is considered that it overrides methods that were declared before it, not for category methods introduced after it. This is tradeoff in favor of performance, since it is expensive to do lookups in case there was a category, and moving the global method pool to ASTContext (so we can check it) would increase complexity. rdar://13508196 llvm-svn: 179654
OpenPOWER on IntegriCloud