summaryrefslogtreecommitdiffstats
path: root/test/Parser/cxx-default-args.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Parse: Don't crash when default argument in typedef consists of sole '='David Majnemer2015-01-131-0/+1
| | | | | | | | We'd crash trying to make the SourceRange for the tokens we'd like to highlight. Don't assume there is more than one token makes up the default argument. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225774 91177308-0d34-0410-b5e6-96231b3b80d8
* Parse: Don't crash if missing an initializer expressionDavid Majnemer2015-01-131-0/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225768 91177308-0d34-0410-b5e6-96231b3b80d8
* Test case for my r218780 patch.Fariborz Jahanian2014-10-011-0/+5
| | | | | | | | Suggested by Richard Smith. rdar://18508589. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218830 91177308-0d34-0410-b5e6-96231b3b80d8
* PR13657 (and duplicates):Richard Smith2013-09-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a comma occurs in a default argument or default initializer within a class, disambiguate whether it is part of the initializer or whether it ends the initializer. The way this works (which I will be proposing for standardization) is to treat the comma as ending the default argument or default initializer if the following token sequence matches the syntactic constraints of a parameter-declaration-clause or init-declarator-list (respectively). This is both consistent with the disambiguation rules elsewhere (where entities are treated as declarations if they can be), and should have no regressions over our old behavior. I think it might also disambiguate all cases correctly, but I don't have a proof of that. There is an annoyance here: because we're performing a tentative parse in a situation where we may not have seen declarations of all relevant entities (if the comma is part of the initializer, lookup may find entites declared later in the class), we need to turn off typo-correction and diagnostics during the tentative parse, and in the rare case that we decide the comma is part of the initializer, we need to revert all token annotations we performed while disambiguating. Any diagnostics that occur outside of the immediate context of the tentative parse (for instance, if we trigger the implicit instantiation of a class template) are *not* suppressed, mirroring the usual rules for a SFINAE context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190639 91177308-0d34-0410-b5e6-96231b3b80d8
* Change warning about incomplete parsing of C++ default arg to error and ↵Argyrios Kyrtzidis2010-08-091-0/+4
| | | | | | provide a test case; thanks Doug! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110603 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce a new token kind 'cxx_defaultarg_end' to mark the end of C++ ↵Argyrios Kyrtzidis2010-08-061-0/+3
| | | | | | | | | | | | | | | | default arguments that were part of lexed method declarations. This avoid interference with tokens coming after the point where the default arg tokens were 'injected', e.g. for typedef struct Inst { void m(int x=0); } *InstPtr; when parsing '0' the next token would be '*' and things would be messed up. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110436 91177308-0d34-0410-b5e6-96231b3b80d8
* When "delayed parsing" C++ default arguments, if there is an error, there ↵Argyrios Kyrtzidis2010-03-301-0/+9
may be tokens left in the token stream that will interfere (they will be parsed as if they are after the class' '}') and a crash will occur because the CachedTokens that holds them will be deleted while the lexer is still using them. Make sure that the tokens of default args are removed from the token stream. Fixes PR6647. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99939 91177308-0d34-0410-b5e6-96231b3b80d8