[cfe-commits] r74260 - /cfe/trunk/lib/Parse/ParseExprCXX.cpp

Chris Lattner sabre at nondot.org
Thu Jun 25 20:47:47 PDT 2009


Author: lattner
Date: Thu Jun 25 22:47:46 2009
New Revision: 74260

URL: http://llvm.org/viewvc/llvm-project?rev=74260&view=rev
Log:
move some code around, no functionality change.

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

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

==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu Jun 25 22:47:46 2009
@@ -59,6 +59,38 @@
 
   while (true) {
     // nested-name-specifier:
+    //   nested-name-specifier 'template'[opt] simple-template-id '::'
+
+    // Parse the optional 'template' keyword, then make sure we have
+    // 'identifier <' after it.
+    if (Tok.is(tok::kw_template)) {
+      SourceLocation TemplateKWLoc = ConsumeToken();
+      
+      if (Tok.isNot(tok::identifier)) {
+        Diag(Tok.getLocation(), 
+             diag::err_id_after_template_in_nested_name_spec)
+          << SourceRange(TemplateKWLoc);
+        break;
+      }
+      
+      if (NextToken().isNot(tok::less)) {
+        Diag(NextToken().getLocation(),
+             diag::err_less_after_template_name_in_nested_name_spec)
+          << Tok.getIdentifierInfo()->getName()
+          << SourceRange(TemplateKWLoc, Tok.getLocation());
+        break;
+      }
+      
+      TemplateTy Template 
+        = Actions.ActOnDependentTemplateName(TemplateKWLoc,
+                                             *Tok.getIdentifierInfo(),
+                                             Tok.getLocation(), SS);
+      AnnotateTemplateIdToken(Template, TNK_Dependent_template_name,
+                              &SS, TemplateKWLoc, false);
+      continue;
+    }
+    
+    // nested-name-specifier:
     //   type-name '::'
     //   namespace-name '::'
     //   nested-name-specifier identifier '::'
@@ -83,41 +115,9 @@
       SS.setEndLoc(CCLoc);
       continue;
     }
-
-    
-    // Parse the optional 'template' keyword, then make sure we have
-    // 'identifier <' after it.
-    if (Tok.is(tok::kw_template)) {
-      SourceLocation TemplateKWLoc = ConsumeToken();
-      
-      if (Tok.isNot(tok::identifier)) {
-        Diag(Tok.getLocation(), 
-             diag::err_id_after_template_in_nested_name_spec)
-        << SourceRange(TemplateKWLoc);
-        break;
-      }
-      
-      if (NextToken().isNot(tok::less)) {
-        Diag(NextToken().getLocation(),
-             diag::err_less_after_template_name_in_nested_name_spec)
-        << Tok.getIdentifierInfo()->getName()
-        << SourceRange(TemplateKWLoc, Tok.getLocation());
-        break;
-      }
-      
-      TemplateTy Template 
-      = Actions.ActOnDependentTemplateName(TemplateKWLoc,
-                                           *Tok.getIdentifierInfo(),
-                                           Tok.getLocation(),
-                                           SS);
-      AnnotateTemplateIdToken(Template, TNK_Dependent_template_name,
-                              &SS, TemplateKWLoc, false);
-      continue;
-    }
     
     // nested-name-specifier:
     //   type-name '::'
-    //   nested-name-specifier 'template'[opt] simple-template-id '::'
     if (Tok.is(tok::identifier) && NextToken().is(tok::less)) {
       TemplateTy Template;
       TemplateNameKind TNK = Actions.isTemplateName(*Tok.getIdentifierInfo(),





More information about the cfe-commits mailing list