summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Parse: Handle __declspec in a lambda definitionDavid Majnemer2015-02-041-0/+5
| | | | llvm-svn: 228121
* Follow-up to r217302: Don't crash on ~A::A in a postfix expr suffix followed ↵Nico Weber2015-02-021-0/+2
| | | | | | | | | | | | | | | | | by '<'. This used to crash, complaining "ObjectType and scope specifier cannot coexist": struct A { } b = b.~A::A <int>; The only other caller of ParseOptionalCXXScopeSpecifier() that passes in a non-empty ObjectType clears the ObjectType of the scope specifier comes back non-empty (see the tok::period case in Parser::ParsePostfixExpressionSuffix()), so do that here too. Found by SLi's bot. llvm-svn: 227781
* Remove a comment I accidentally added in r227581. No behavior change.Nico Weber2015-02-021-2/+1
| | | | llvm-svn: 227777
* Follow-up to r217302 and r227555: Don't crash on inline ~A::A() if A is an int.Nico Weber2015-01-301-1/+7
| | | | | | | | | | | | | | | | | | | Even with r227555, this still crashed: struct S { int A; ~A::A() {} }; That's because ParseOptionalCXXScopeSpecifier()'s call to ActOnCXXNestedNameSpecifier() doesn't mark the scope spec as invalid if sema thought it's a good idea to fixit-correct "::" to ":". For the diagnostic improvement done in r217302, we never want :: to be interpreted as :, so fix this by setting ColonSacred to false temporarily. Found by SLi's bot. llvm-svn: 227581
* Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.Nico Weber2015-01-301-1/+2
| | | | llvm-svn: 227555
* Initial support for C++ parameter completionFrancisco Lopes da Silva2015-01-211-2/+13
| | | | | | | | | | | | | | | | | | | | The improved completion in call context now works with: - Functions. - Member functions. - Constructors. - New expressions. - Function call expressions. - Template variants of the previous. There are still rough edges to be fixed: - Provide support for optional parameters. (fix known) - Provide support for member initializers. (fix known) - Provide support for variadic template functions. (fix unknown) - Others? llvm-svn: 226670
* Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.Richard Smith2015-01-151-0/+5
| | | | llvm-svn: 226067
* Parse: It's cleaner to handle cxx_defaultarg_end in SkipUntil directlyDavid Majnemer2015-01-121-10/+3
| | | | llvm-svn: 225616
* Parse: Don't parse beyond the end of the synthetic default argument tokDavid Majnemer2015-01-121-3/+10
| | | | | | | | Recovery from malformed lambda introducers would find us consuming the synthetic default argument token, which is bad. Instead, stop right before that token. llvm-svn: 225613
* Parse: Don't crash when trailing return type is missingDavid Majnemer2015-01-091-5/+4
| | | | | | | | | Sema::CheckParmsForFunctionDef can't cope with a null TypeSourceInfo. Don't let the AST contain the malformed lambda. This fixes PR22122. llvm-svn: 225505
* Fix build breakageDavid Majnemer2014-12-291-1/+2
| | | | | | That's what I get for last second changes... llvm-svn: 224967
* Parse: Recover more gracefully from extra :: tokens before a {David Majnemer2014-12-291-1/+11
| | | | | | | Instead of crashing, recover by eating the extra trailing scope qualifier. This means we will treat 'struct A:: {' as 'struct A {'. llvm-svn: 224966
* Parse: Ignore '::' in 'struct :: {'David Majnemer2014-12-291-5/+11
| | | | | | | Let's pretend that we didn't see the '::' instead of go on believing that we've got some anonymous, but globally qualified, struct. llvm-svn: 224945
* Parse: Consume tokens more carefully in CheckForLParenAfterColonColonDavid Majnemer2014-12-171-27/+29
| | | | | | | | | We would consume the lparen even if it wasn't followed by an identifier or a star-identifier pair. This fixes PR21815. llvm-svn: 224403
* Wire up delayed typo correction to DiagnoseEmptyLookup and set upKaelyn Takata2014-11-201-18/+33
| | | | | | | | | Sema::ActOnIdExpression to use the new functionality. Among other things, this allows recovery in several cases where it wasn't possible before (e.g. correcting a mistyped static_cast<>). llvm-svn: 222464
* PR21437, final part of DR1330: delay-parsing of exception-specifications. ThisRichard Smith2014-11-131-2/+7
| | | | | | | is a re-commit of Doug's r154844 (modernized and updated to fit into current Clang). llvm-svn: 221918
* Remove the last couple uses of the ExprArg(just Expr*) typedef in Parser.Craig Topper2014-10-301-1/+1
| | | | llvm-svn: 220897
* Add RestrictQualifierLoc to DeclaratorChunk::FunctionTypeInfoHal Finkel2014-10-201-0/+2
| | | | | | | | | | | | | | Clang supports __restrict__ as a function qualifier, but DeclaratorChunk::FunctionTypeInfo lacked a field to track the qualifier's source location (as we do with volatile, etc.). This was the subject of a FIXME in GetFullTypeForDeclarator (in SemaType.cpp). This should also prove useful as we add more warnings regarding questionable uses of the restrict qualifier. There is no significant functional change (except for an improved source range associated with the err_invalid_qualified_function_type diagnostic fixit generated by GetFullTypeForDeclarator). llvm-svn: 220215
* PR20991: ::decltype is not valid.Richard Smith2014-10-041-1/+2
| | | | llvm-svn: 219043
* -ms-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-1/+11
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Add error, recovery and fixit for "~A::A() {...}".Richard Smith2014-09-061-2/+21
| | | | llvm-svn: 217302
* Wrap to 80 columns, no functionality change.Nico Weber2014-07-261-2/+2
| | | | llvm-svn: 214036
* PR19751: (T())++ is not a cast-expression.Richard Smith2014-07-151-1/+0
| | | | llvm-svn: 213022
* Convert StringLiteralParser constructor to use ArrayRef instead of a pointer ↵Craig Topper2014-06-261-1/+1
| | | | | | and count. llvm-svn: 211763
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-13/+13
| | | | | | takeAs to getAs. llvm-svn: 209800
* [C++11] Use 'nullptr'. Parser edition.Craig Topper2014-05-211-19/+19
| | | | llvm-svn: 209275
* Replace completely bogus ambiguous-compound-literal-in-C++ code with somethingRichard Smith2014-05-151-2/+4
| | | | | | that isn't always wrong. llvm-svn: 208844
* PR19748: Make sure we don't lose colon protection after the parenthesized ↵Richard Smith2014-05-151-4/+11
| | | | | | type-id in a cast-expression. llvm-svn: 208843
* Cut off parsing early during code completionAlp Toker2014-05-021-3/+3
| | | | | | | | | These calls to ConsumeCodeCompletionToken() caused parsing to continue needlessly when an immediate cutOffParsing() would do. Document the function to clarify its correct usage. llvm-svn: 207823
* Improve error recovery around colon.Serge Pavlov2014-04-131-9/+36
| | | | | | | | | | Parse of nested name spacifier is modified so that it properly recovers if colon is mistyped as double colon in case statement. This patch fixes PR15133. Differential Revision: http://llvm-reviews.chandlerc.com/D2870 llvm-svn: 206135
* PR19339: Disambiguate lambdas with init-captures from designated initializersRichard Smith2014-04-131-2/+2
| | | | | | properly. llvm-svn: 206128
* Allow GNU-style attributes on lambda expressions.Aaron Ballman2014-03-121-3/+12
| | | | llvm-svn: 203628
* Gracefully handle an attribute specifier following a lambda introducer when ↵Aaron Ballman2014-03-111-6/+18
| | | | | | the parameter list wasn't present. llvm-svn: 203565
* [cleanup] Re-sort includes with llvm/utils/sort_includes.py and fixChandler Carruth2014-03-041-1/+1
| | | | | | | | | | | | a missing include from CLog.h. CLog.h referenced most of the core libclang types but never directly included Index.h that provides them. Previously it got lucky and other headers were always included first but with the sorting it ended up first in one case and stopped compiling. Adding the Index.h include fixes it right up. llvm-svn: 202810
* Fix for PR9812: warn about bool instead of _Bool.Erik Verbruggen2014-01-151-20/+23
| | | | llvm-svn: 199311
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Bring back magic constants in the digraph diagnosticAlp Toker2014-01-071-3/+18
| | | | | | | | This backs out changes in commit r198605 and part of r198604, replacing the original tok::kw_template with a slightly more obvious placeholder tok::unknown. llvm-svn: 198666
* Don't use magic constants in the digraph diagnosticAlp Toker2014-01-061-16/+3
| | | | llvm-svn: 198605
* Parse: Token consumption modernization and loop de-nestingAlp Toker2014-01-051-3/+1
| | | | | | Cleanup only. llvm-svn: 198539
* Eliminate UnaryTypeTraitExprAlp Toker2014-01-011-13/+2
| | | | | | | | | | | | | Remove UnaryTypeTraitExpr and switch all remaining type trait related handling over to TypeTraitExpr. The UTT/BTT/TT enum prefix and evaluation code is retained pending further cleanup. This is part of the ongoing work to unify type traits following the removal of BinaryTypeTraitExpr in r197273. llvm-svn: 198271
* ExpectAndConsume: Diagnose errors automaticallyAlp Toker2014-01-011-5/+5
| | | | | | | | | | | | | | 1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics using the generic diagnostic descriptions added in r197972, eliminating another set of trivial err_expected_* variations while maintaining existing behaviour. 2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume family of functions are primitive parser operations that now have the well-defined property of operating on single tokens. Factoring out recovery exposes opportunities for more consistent and tailored error recover at the call sites instead of just relying on a bottled SkipUntil formula. llvm-svn: 198270
* Support and use token kinds as diagnostic argumentsAlp Toker2013-12-241-2/+2
| | | | | | | | | | | | | | | | | | | Introduce proper facilities to render token spellings using the diagnostic formatter. Replaces most of the hard-coded diagnostic messages related to expected tokens, which all shared the same semantics but had to be multiply defined due to variations in token order or quote marks. The associated parser changes are largely mechanical but they expose commonality in whole chunks of the parser that can now be factored away. This commit uses C++11 typed enums along with a speculative legacy fallback until the transition is complete. Requires corresponding changes in LLVM r197895. llvm-svn: 197972
* Refactor and micro-optimize ConsumeToken()Alp Toker2013-12-171-16/+9
| | | | | | | | | | | | 1) Introduce TryConsumeToken() to handle the common test-and-consume pattern. This brings about readability improvements in the parser and optimizes to avoid redundant checks in the common case. 2) Eliminate the ConsumeCodeCompletionTok special case from ConsumeToken(). This was used by only one caller which has been switched over to the more appropriate ConsumeCodeCompletionToken() function. llvm-svn: 197497
* Remove an unused parameter and include after r197273Alp Toker2013-12-131-2/+1
| | | | llvm-svn: 197274
* Eliminate BinaryTypeTraitExprAlp Toker2013-12-131-18/+6
| | | | | | | | | | | | | | | | | There's nothing special about type traits accepting two arguments. This commit eliminates BinaryTypeTraitExpr and switches all related handling over to TypeTraitExpr. Also fixes a CodeGen failure with variadic type traits appearing in a non-constant expression. The BTT/TT prefix and evaluation code is retained as-is for now but will soon be further cleaned up. This is part of the ongoing work to unify type traits. llvm-svn: 197273
* Unify type trait parsingAlp Toker2013-12-121-124/+46
| | | | | | | | | | | | | | | | | Type trait parsing is all over the place at the moment with unary, binary and n-ary C++11 type traits that were developed independently at different points in clang's history. There's no good reason to handle them separately -- there are three parsers, three AST nodes and lots of duplicated handling code with slightly different implementations and diags for each kind. This commit unifies parsing of type traits and sets the stage for further consolidation. No change in behaviour other than more consistent error recovery. llvm-svn: 197179
* Fix init-captures for generic lambdas.Faisal Vali2013-12-051-6/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For an init capture, process the initialization expression right away. For lambda init-captures such as the following: const int x = 10; auto L = [i = x+1](int a) { return [j = x+2, &k = x](char b) { }; }; keep in mind that each lambda init-capture has to have: - its initialization expression executed in the context of the enclosing/parent decl-context. - but the variable itself has to be 'injected' into the decl-context of its lambda's call-operator (which has not yet been created). Each init-expression is a full-expression that has to get Sema-analyzed (for capturing etc.) before its lambda's call-operator's decl-context, scope & scopeinfo are pushed on their respective stacks. Thus if any variable is odr-used in the init-capture it will correctly get captured in the enclosing lambda, if one exists. The init-variables above are created later once the lambdascope and call-operators decl-context is pushed onto its respective stack. Since the lambda init-capture's initializer expression occurs in the context of the enclosing function or lambda, therefore we can not wait till a lambda scope has been pushed on before deciding whether the variable needs to be captured. We also need to process all lvalue-to-rvalue conversions and discarded-value conversions, so that we can avoid capturing certain constant variables. For e.g., void test() { const int x = 10; auto L = [&z = x](char a) { <-- don't capture by the current lambda return [y = x](int i) { <-- don't capture by enclosing lambda return y; } }; If x was not const, the second use would require 'L' to capture, and that would be an error. Make sure TranformLambdaExpr is also aware of this. Patch approved by Richard (Thanks!!) http://llvm-reviews.chandlerc.com/D2092 llvm-svn: 196454
* Reject template-ids containing literal-operator-ids that have a dependentRichard Smith2013-12-051-5/+10
| | | | | | | | | nested-name-specifier, rather than crashing. (In fact, reject all literal-operator-ids that have a non-namespace nested-name-specifier). The grammar doesn't allow these in some cases, and in other cases does allow them but instantiation will always fail. llvm-svn: 196443
* Fix several crash-on-invalids when using template-ids that aren'tRichard Smith2013-12-041-3/+4
| | | | | | simple-template-ids (eg, 'operator+<int>') in weird places. llvm-svn: 196333
* Replaced bool parameters in SkipUntil function with single bit-based parameter.Alexey Bataev2013-11-181-21/+21
| | | | llvm-svn: 194994
OpenPOWER on IntegriCloud