[cfe-commits] r61656 - /cfe/trunk/lib/Parse/ParseTemplate.cpp

Chris Lattner sabre at nondot.org
Sun Jan 4 15:51:17 PST 2009


Author: lattner
Date: Sun Jan  4 17:51:17 2009
New Revision: 61656

URL: http://llvm.org/viewvc/llvm-project?rev=61656&view=rev
Log:
Simplify some control flow and remove a call to TryAnnotateCXXScopeToken
that isn't doing what is desired. It was annotating the current token
not the 'next' token.  This code should be fixed.

Modified:
    cfe/trunk/lib/Parse/ParseTemplate.cpp

Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=61656&r1=61655&r2=61656&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Sun Jan  4 17:51:17 2009
@@ -175,21 +175,20 @@
 ///         'template' '<' template-parameter-list '>' 'class' identifier[opt] = id-expression
 Parser::DeclTy *
 Parser::ParseTemplateParameter(unsigned Depth, unsigned Position) {
-  TryAnnotateCXXScopeToken();
-
-  if(Tok.is(tok::kw_class) 
-     || (Tok.is(tok::kw_typename) && 
+  if(Tok.is(tok::kw_class) ||
+     (Tok.is(tok::kw_typename) && 
+         // FIXME: Next token has not been annotated!
 	 NextToken().isNot(tok::annot_qualtypename))) {
     return ParseTypeParameter(Depth, Position);
-  } else if(Tok.is(tok::kw_template)) {
-    return ParseTemplateTemplateParameter(Depth, Position);
-  } else {
-    // If it's none of the above, then it must be a parameter declaration.
-    // NOTE: This will pick up errors in the closure of the template parameter
-    // list (e.g., template < ; Check here to implement >> style closures.
-    return ParseNonTypeTemplateParameter(Depth, Position);
   }
-  return 0;
+  
+  if(Tok.is(tok::kw_template))
+    return ParseTemplateTemplateParameter(Depth, Position);
+
+  // If it's none of the above, then it must be a parameter declaration.
+  // NOTE: This will pick up errors in the closure of the template parameter
+  // list (e.g., template < ; Check here to implement >> style closures.
+  return ParseNonTypeTemplateParameter(Depth, Position);
 }
 
 /// ParseTypeParameter - Parse a template type parameter (C++ [temp.param]).





More information about the cfe-commits mailing list