aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-12-01 23:54:00 +0000
committerDouglas Gregor <dgregor@apple.com>2008-12-01 23:54:00 +0000
commitadcac8824a9cff13f1ef61a69e38c1041cba12ee (patch)
treef2cc5aa1535102cf64536a756a9b645a242dddf5 /lib/Parse/ParseDecl.cpp
parentcb43d999520f547d682a1ca280ecfedb115ee1fd (diff)
Basic support for parsing templates, from Andrew Sutton
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 4280c6050c..192c70a192 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -202,11 +202,15 @@ AttributeList *Parser::ParseAttributes() {
/// block-declaration ->
/// simple-declaration
/// others [FIXME]
+/// [C++] template-declaration
/// [C++] namespace-definition
/// others... [FIXME]
///
Parser::DeclTy *Parser::ParseDeclaration(unsigned Context) {
switch (Tok.getKind()) {
+ case tok::kw_export:
+ case tok::kw_template:
+ return ParseTemplateDeclaration(Context);
case tok::kw_namespace:
return ParseNamespace(Context);
default:
@@ -417,7 +421,8 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) {
/// [C++] 'virtual'
/// [C++] 'explicit'
///
-void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
+void Parser::ParseDeclarationSpecifiers(DeclSpec &DS)
+{
DS.SetRangeStart(Tok.getLocation());
while (1) {
int isInvalid = false;
@@ -431,9 +436,11 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
switch (Tok.getKind()) {
default:
- // Try to parse a type-specifier; if we found one, continue.
- if (MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec))
+ // Try to parse a type-specifier; if we found one, continue. If it's not
+ // a type, this falls through.
+ if (MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) {
continue;
+ }
DoneWithDeclSpec:
// If this is not a declaration specifier token, we're done reading decl
@@ -612,6 +619,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
ConsumeToken();
}
}
+
/// MaybeParseTypeSpecifier - Try to parse a single type-specifier. We
/// primarily follow the C++ grammar with additions for C99 and GNU,
/// which together subsume the C grammar. Note that the C++