summaryrefslogtreecommitdiffstats
path: root/clang/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
commiteb31f39558ce38d227e02b2f7cd85dd368c0d835 (patch)
tree8348a8e274543748dcd3272725d8c347483a8b81 /clang/lib/Parse/ParseDecl.cpp
parent351b6659adab51addbffb87f7caa59ba4fd026f7 (diff)
downloadbcm5719-llvm-eb31f39558ce38d227e02b2f7cd85dd368c0d835.tar.gz
bcm5719-llvm-eb31f39558ce38d227e02b2f7cd85dd368c0d835.zip
Basic support for parsing templates, from Andrew Sutton
llvm-svn: 60384
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 4280c6050c3..192c70a192e 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/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++
OpenPOWER on IntegriCloud