]> granicus.if.org Git - clang/commit
Implement parsing of nested-name-specifiers that involve template-ids, e.g.,
authorDouglas Gregor <dgregor@apple.com>
Wed, 25 Feb 2009 19:37:18 +0000 (19:37 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 25 Feb 2009 19:37:18 +0000 (19:37 +0000)
commit39a8de10c18365bde7062d8959b7ed525449c561
tree0de42dd5a33f1dce18647222a5802e6f14fce250
parent0096acf421c4609ce7f43e8b05f8c5ca866d4611
Implement parsing of nested-name-specifiers that involve template-ids, e.g.,

  std::vector<int>::allocator_type

When we parse a template-id that names a type, it will become either a
template-id annotation (which is a parsed representation of a
template-id that has not yet been through semantic analysis) or a
typename annotation (where semantic analysis has resolved the
template-id to an actual type), depending on the context. We only
produce a type in contexts where we know that we only need type
information, e.g., in a type specifier. Otherwise, we create a
template-id annotation that can later be "upgraded" by transforming it
into a typename annotation when the parser needs a type. This occurs,
for example, when we've parsed "std::vector<int>" above and then see
the '::' after it. However, it means that when writing something like
this:

  template<> class Outer::Inner<int> { ... };

We have two tokens to represent Outer::Inner<int>: one token for the
nested name specifier Outer::, and one template-id annotation token
for Inner<int>, which will be passed to semantic analysis to define
the class template specialization.

Most of the churn in the template tests in this patch come from an
improvement in our error recovery from ill-formed template-ids.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65467 91177308-0d34-0410-b5e6-96231b3b80d8
25 files changed:
docs/InternalsManual.html
include/clang/Basic/DiagnosticParseKinds.def
include/clang/Basic/TemplateKinds.h [new file with mode: 0644]
include/clang/Lex/Preprocessor.h
include/clang/Lex/Token.h
include/clang/Parse/Action.h
include/clang/Parse/Ownership.h
include/clang/Parse/Parser.h
lib/AST/DeclTemplate.cpp
lib/Parse/MinimalAction.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseTemplate.cpp
lib/Parse/Parser.cpp
lib/Sema/Sema.h
lib/Sema/SemaCXXScopeSpec.cpp
lib/Sema/SemaTemplate.cpp
test/SemaTemplate/class-template-spec.cpp
test/SemaTemplate/default-arguments.cpp
test/SemaTemplate/nested-name-spec-template.cpp [new file with mode: 0644]
test/SemaTemplate/temp_arg.cpp
test/SemaTemplate/temp_arg_nontype.cpp
test/SemaTemplate/temp_arg_template.cpp
test/SemaTemplate/temp_arg_type.cpp