summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR16094: I should have known Obj-C init-capture disambiguation couldn't beRichard Smith2013-05-211-7/+73
| | | | | | | | | | | | | | | | | | | | | *that* easy... Try a bit harder to disambiguate. This is mostly straightforward, but for =-style initializers, we actually need to know where an expression ends: [foo = bar baz] is a message send, whereas [foo = bar + baz] is a lambda-introducer. Handle this by parsing the expression eagerly, and replacing it with an annotation token. By chance, we use the *exact same* parsing rules in both cases (except that we need to assume we're inside a message send for the parse, to turn off various forms of inapplicable error recovery). llvm-svn: 182432
* First pass of semantic analysis for init-captures: check the initializer, buildRichard Smith2013-05-161-4/+2
| | | | | | | | | | | | | a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. llvm-svn: 181985
* C++1y n3648: parse and reject init-captures for now.Richard Smith2013-05-091-2/+36
| | | | llvm-svn: 181553
* Separate out and special-case the diagnostic for 'auto' in aRichard Smith2013-05-041-1/+1
| | | | | | | conversion-type-id, in preparation for this becoming valid in c++1y mode. No functionality change; small diagnostic improvement. llvm-svn: 181089
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-301-0/+2
| | | | | | | | 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
* Implement C++1y decltype(auto).Richard Smith2013-04-261-1/+1
| | | | llvm-svn: 180610
* Implement compiler intrinsics needed for compatibility with MSVC 2012 ↵Joao Matos2013-03-271-0/+4
| | | | | | | | <type_traits>. Patch by me and Ryan Molden. llvm-svn: 178111
* Implement special-case name lookup for inheriting constructors: memberRichard Smith2013-03-261-3/+19
| | | | | | | using-declarations with names which look constructor-like are interpreted as constructor names. llvm-svn: 177957
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-4/+4
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Process and handle attributes on conditions and for loop variables. Process andRichard Smith2013-02-201-0/+1
| | | | | | | diagnose attributes on alias declarations, using directives, and attribute declarations. llvm-svn: 175649
* Finish semantic analysis for [[carries_dependency]] attribute.Richard Smith2013-01-281-0/+1
| | | | | | | | | | This required plumbing through a new flag to determine whether a ParmVarDecl is actually a parameter of a function declaration (as opposed to a function typedef etc, where the attribute is prohibited). Weirdly, this attribute (just like [[noreturn]]) cannot be applied to a function type, just to a function declaration (and its parameters). llvm-svn: 173726
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-7/+7
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* s/CXX0X/CXX11/g, except for __GNU_EXPERIMENTAL_CXX0X__, and update a few ↵Richard Smith2013-01-021-3/+3
| | | | | | nearby 'C++0x' comments. llvm-svn: 171372
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-6/+6
| | | | llvm-svn: 171367
* Revert r170500. It over-zealously converted *ALL* things named Attributes, ↵Bill Wendling2012-12-201-1/+1
| | | | | | which is wrong here. llvm-svn: 170721
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-1/+1
| | | | | | single attribute in the future. llvm-svn: 170500
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fix sentence construction-o.Nico Weber2012-11-291-1/+1
| | | | llvm-svn: 168855
* When finding a '(' after '::', emit error with hint to remove '(' and matchingRichard Trieu2012-11-021-1/+44
| | | | | | | ')', if found. Don't crash. Fixes PR11852. llvm-svn: 167268
* DR1473: Do not require a space between operator"" and the ud-suffix in aRichard Smith2012-10-201-5/+10
| | | | | | literal-operator-id. llvm-svn: 166373
* Fixed FunctionTypeLoc source range.Abramo Bagnara2012-10-041-27/+36
| | | | llvm-svn: 165259
* Fix an edge case of mangling involving the combination of a lambda and typeid.Eli Friedman2012-09-261-1/+2
| | | | | | | | | | | | | typeid (and a couple other non-standard places where we can transform an unevaluated expression into an evaluated expression) is special because it introduces an an expression evaluation context, which conflicts with the mechanism to compute the current lambda mangling context. PR12123. I would appreciate if someone would double-check that we get the mangling correct with this patch. llvm-svn: 164658
* Add the Microsoft __is_interface_class type trait.John McCall2012-09-251-0/+1
| | | | | | Patch by Andy Gibbs! llvm-svn: 164591
* Fix a few -Wdocumentation warnings.Dmitri Gribenko2012-08-241-6/+6
| | | | llvm-svn: 162506
* Now that ASTMultiPtr is nothing more than a array reference, make it a ↵Benjamin Kramer2012-08-231-4/+2
| | | | | | | | MutableArrayRef. This required changing all get() calls to data() and using the simpler constructors. llvm-svn: 162501
* Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer2012-08-231-3/+3
| | | | | | SmallVector. llvm-svn: 162492
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-10/+10
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* PR13619: Make sure we're not at EOF before looking at NextToken().Richard Smith2012-08-201-4/+5
| | | | llvm-svn: 162212
* PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers andRichard Smith2012-08-181-10/+15
| | | | | | | | | | | | | | | | | nested names as id-expressions, using the annot_primary_expr annotation, where possible. This removes some redundant lookups, and also allows us to typo-correct within tentative parsing, and to carry on disambiguating past an identifier which we can determine will fail lookup as both a type and as a non-type, allowing us to disambiguate more declarations (and thus offer improved error recovery for such cases). This also introduces to the parser the notion of a tentatively-declared name, which is an identifier which we *might* have seen a declaration for in a tentative parse (but only if we end up disambiguating the tokens as a declaration). This is necessary to correctly disambiguate cases where a variable is used within its own initializer. llvm-svn: 162159
* In 'delete []', the '[]' never starts a lambda. Update a FIXME with a ↵Richard Smith2012-08-091-4/+8
| | | | | | standard reference and add a test. llvm-svn: 161604
* Tweak code-completion heuristics deciding between a lambdaDouglas Gregor2012-07-311-1/+3
| | | | | | | code-completion and an Objective-C message send, based on Jordan's feedback. llvm-svn: 161049
* When we encounter a code-completion token while parsing an ill-formedDouglas Gregor2012-07-311-1/+5
| | | | | | | | lambda-introducer in Objective-C++11, fall back to treating the tokens as an Objective-C message send to provide those (more likely) completions. Fixes <rdar://problem/11980263>. llvm-svn: 161015
* Improvements to vexing-parse warnings. Make the no-parameters case moreRichard Smith2012-07-301-1/+2
| | | | | | | | | | | | | accurate by asking the parser whether there was an ambiguity rather than trying to reverse-engineer it from the DeclSpec. Make the with-parameters case have better diagnostics by using semantic information to drive the warning, improving the diagnostics and adding a fixit. Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for declarations of the form 'T (*x)(...)', which seem to have a very high false positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'. llvm-svn: 160998
* Clean up a large number of C++11 attribute parse issues, including parsingAlexis Hunt2012-06-231-0/+5
| | | | | | | | | | | | | | | | | | attributes in more places where we didn't and catching a lot more issues. This implements nearly every aspect of C++11 attribute parsing, except for: - Attributes are permitted on explicit instantiations inside the declarator (but not preceding the decl-spec) - Attributes are permitted on friend declarations of functions. - Multiple instances of the same attribute in an attribute-list (e.g. [[noreturn, noreturn]], not [[noreturn]] [[noreturn]] which is conforming) are allowed. The first two are marked as expected-FIXME in the test file and the latter is probably a defect and is currently untested. Thanks to Richard Smith for providing the lion's share of the testcases. llvm-svn: 159072
* Extend the error recovery for a template-argument-list terminated by '>>' toRichard Smith2012-06-181-3/+3
| | | | | | | | | also deal with '>>>' (in CUDA), '>=', and '>>='. Fix the FixItHints logic to deal with cases where the token is followed by an adjacent '=', '==', '>=', '>>=', or '>>>' token, where a naive fix-it would result in a differing token stream on a re-lex. llvm-svn: 158652
* Move isCXXSimpleTypeSpecifier from Parser to Sema and tweak it for wider use.Kaelyn Uhrain2012-06-151-33/+0
| | | | llvm-svn: 158572
* If parsing a trailing-return-type fails, don't pretend we didn't have one atRichard Smith2012-06-121-4/+4
| | | | | | all. Suppresses follow-on errors mentioned in PR13074. llvm-svn: 158348
* Whenever we have a BalancedDelimiterTracker, we have a 'nested' scopeDouglas Gregor2012-06-061-2/+0
| | | | | | | where '>' is going to behave as an operator (and not as a '>' closing a template argument list). llvm-svn: 158111
* Revert most of r154844, which was disabled in r155975. Keep around theRichard Smith2012-05-021-7/+2
| | | | | | | refactorings in that revision, and some of the subsequent bugfixes, which seem to be relevant even without delayed exception specification parsing. llvm-svn: 156031
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-161-4/+9
| | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. llvm-svn: 154844
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* Parser: Don't manage TemplateAnnotationIds in a delayed cleanup pool.Benjamin Kramer2012-04-141-1/+1
| | | | | | | | | | Instead, make it the allocation function's responsibility to add them to a list and clear it when a top-level decl is finished. This plugs leakage of TemplateAnnotationIds. DelayedCleanupPool is ugly and unused, remove it. llvm-svn: 154743
* Disambiguation of '[[':Richard Smith2012-04-101-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject array sizes and array indexes which begin with a lambda-expression. Recover by parsing the lambda as a lambda. * In Objective-C++11, either '[' could be the start of a message-send. Fully disambiguate this case: it turns out that the grammars of message-sends, lambdas and attributes do not actually overlap. Accept any occurrence of '[[' where either '[' starts a message send, but reject a lambda in an array index just like in C++11 mode. Implement a couple of changes to the attribute wording which occurred after our attributes implementation landed: * In a function-declaration, the attributes go after the exception specification, not after the right paren. * A reference type can have attributes applied. * An 'identifier' in an attribute can also be a keyword. Support for alternative tokens (iso646 keywords) in attributes to follow. And some bug fixes: * Parse attributes after declarator-ids, even if they are not simple identifiers. * Do not accept attributes after a parenthesized declarator. * Accept attributes after an array size in a new-type-id. * Partially disamiguate 'delete' followed by a lambda. More work is required here for the case where the lambda-introducer is '[]'. llvm-svn: 154369
* For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this isRichard Smith2012-04-041-0/+4
| | | | | | | | | | a type specifier and can be combined with unsigned. This allows libstdc++4.7 to be used with clang in c++98 mode. Several other changes are still required for libstdc++4.7 to work with clang in c++11 mode. llvm-svn: 153999
* Fix parsing of type-specifier-seq's. Types are syntactically allowed to beRichard Smith2012-03-121-16/+1
| | | | | | | | | | | | | | | | | | defined here, but not semantically, so new struct S {}; is always ill-formed, even if there is a struct S in scope. We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being under-loved (due to it only being used in a few places) so merge it into ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this required improving ParseDeclarationSpecifiers' diagnostics in some cases. This also required teaching ParseSpecifierQualifierList about constexpr... which incidentally fixes an issue where we'd allow the constexpr specifier in other bad places. llvm-svn: 152549
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-15/+15
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Fix a couple of issues with literal-operator-id parsing, and provide recoveryRichard Smith2012-03-081-11/+56
| | | | | | | | | | | | for a few kinds of error. Specifically: Since we're after translation phase 6, the "" token might be formed by multiple source-level string literals. Checking the token width is not a correct way of detecting empty string literals, due to escaped newlines. Diagnose and recover from a missing space between "" and suffix, and from string literals other than "", which are followed by a suffix. llvm-svn: 152348
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-1/+6
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-0/+60
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* Provide the __is_trivially_assignable type trait, which providesDouglas Gregor2012-02-231-0/+1
| | | | | | | compiler support for the std::is_trivially_assignable library type trait. llvm-svn: 151240
OpenPOWER on IntegriCloud