Commit Graph

8 Commits

Author SHA1 Message Date
David Majnemer a7ea1b1466 Parse: use the EOF token method to lex inline method bodies
Mark the end of the method body with an EOF token, collect it once we
expect to be done with method body parsing.  No functionality change
intended.

llvm-svn: 225765
2015-01-13 05:06:20 +00:00
David Majnemer 234b8188df Parse: It's cleaner to handle cxx_defaultarg_end in SkipUntil directly
llvm-svn: 225616
2015-01-12 03:36:37 +00:00
Nico Weber c29c4835df Don't crash on surprising tokens in default parameter template lists.
Fixes this snippet from SLi's afl fuzzer output:

  class {
      i (x = <, enum

This parsed i as a function, x as a paramter, and the stuff after < as a
template list.  This then called TryConsumeDeclarationSpecifier() which
called TryAnnotateCXXScopeToken() without checking the preconditions of
this function.  Check them before calling, like all other callers of
TryAnnotateCXXScopeToken() do.

A more readable reproducer that causes the same crash is

  class {
      void i(int x = MyTemplateClass<int, union int>::foo());
  };

The reduced version used an eof token as surprising token, but kw_int works
just as well to repro and is easier to insert into a test file.

llvm-svn: 224906
2014-12-28 23:24:02 +00:00
Richard Smith cde3fd87e0 PR16480: Reimplement token-caching for constructor initializer lists. This
previously didn't work if a mem-initializer-id had a template argument which
contained parentheses or braces.

We now implement a simple rule: just look for a ') {' or '} {' that is not
nested. The '{' is assumed to start the function-body. There are still two
cases which we misparse, where the ') {' comes from a compound literal or
from a lambda. The former case is not valid C++, and the latter will probably
not be valid C++ once DR1607 is resolved, so these seem to be of low value,
and we do not regress on them with this change. EDG and g++ also misparse
both of these cases.

llvm-svn: 185598
2013-07-04 00:13:48 +00:00
Sebastian Redl 0d16401228 Fix a bug in the token caching for inline constructors in C++11, and improve error recovery in both dialects. This should fix the GCC test suite failures as well.
llvm-svn: 140847
2011-09-30 08:32:17 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Daniel Dunbar e9266a3ee1 Add RUN line.
llvm-svn: 81654
2009-09-12 23:06:30 +00:00
Anders Carlsson 085af1fd29 Add a test for PR3733.
llvm-svn: 81622
2009-09-12 19:35:43 +00:00