From 333489bba35d91e4ddb101f441087177c492d090 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 27 Mar 2009 23:10:48 +0000 Subject: Initial implementation of parsing, semantic analysis, and template instantiation for C++ typename-specifiers such as typename T::type The parsing of typename-specifiers is relatively easy thanks to annotation tokens. When we see the "typename", we parse the typename-specifier and produce a typename annotation token. There are only a few places where we need to handle this. We currently parse the typename-specifier form that terminates in an identifier, but not the simple-template-id form, e.g., typename T::template apply Parsing of nested-name-specifiers has a similar problem, since at this point we don't have any representation of a class template specialization whose template-name is unknown. Semantic analysis is only partially complete, with some support for template instantiation that works for simple examples. llvm-svn: 67875 --- clang/lib/Parse/ParseTentative.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'clang/lib/Parse/ParseTentative.cpp') diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp index 2cca2cdb1e1..335a455acfe 100644 --- a/clang/lib/Parse/ParseTentative.cpp +++ b/clang/lib/Parse/ParseTentative.cpp @@ -516,11 +516,11 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract, /// class-specifier /// enum-specifier /// elaborated-type-specifier -/// typename-specifier [TODO] +/// typename-specifier /// cv-qualifier /// /// simple-type-specifier: -/// '::'[opt] nested-name-specifier[opt] type-name [TODO] +/// '::'[opt] nested-name-specifier[opt] type-name /// '::'[opt] nested-name-specifier 'template' /// simple-template-id [TODO] /// 'char' @@ -578,6 +578,7 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract, Parser::TPResult Parser::isCXXDeclarationSpecifier() { switch (Tok.getKind()) { case tok::identifier: // foo::bar + case tok::kw_typename: // typename T::type // Annotate typenames and C++ scope specifiers. If we get one, just // recurse to handle whatever we get. if (TryAnnotateTypeOrScopeToken()) -- cgit v1.2.3