Preliminary parsing and ASTs for template-ids that refer to function
templates, such as make<int&>. These template-ids are only barely
functional for function calls; much more to come.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74563 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index d89f1e1..1220b2d 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -207,13 +207,13 @@
 ///         operator-function-id
 ///         conversion-function-id                [TODO]
 ///         '~' class-name                        [TODO]
-///         template-id                           [TODO]
+///         template-id
 ///
 ///       qualified-id:
 ///         '::'[opt] nested-name-specifier 'template'[opt] unqualified-id
 ///         '::' identifier
 ///         '::' operator-function-id
-///         '::' template-id                      [TODO]
+///         '::' template-id
 ///
 ///       nested-name-specifier:
 ///         type-name '::'
@@ -264,7 +264,7 @@
   //   operator-function-id
   //   conversion-function-id
   //   '~' class-name                        [TODO]
-  //   template-id                           [TODO]
+  //   template-id
   //
   switch (Tok.getKind()) {
   default:
@@ -294,6 +294,29 @@
     return ExprError();
   }
 
+  case tok::annot_template_id: {
+    TemplateIdAnnotation *TemplateId 
+      = static_cast<TemplateIdAnnotation *>(Tok.getAnnotationValue());
+    assert((TemplateId->Kind == TNK_Function_template ||
+            TemplateId->Kind == TNK_Dependent_template_name) &&
+           "A template type name is not an ID expression");
+
+    ASTTemplateArgsPtr TemplateArgsPtr(Actions, 
+                                       TemplateId->getTemplateArgs(),
+                                       TemplateId->getTemplateArgIsType(),
+                                       TemplateId->NumArgs);
+    
+    OwningExprResult Result
+      = Actions.ActOnTemplateIdExpr(TemplateTy::make(TemplateId->Template),
+                                    TemplateId->TemplateNameLoc,
+                                    TemplateId->LAngleLoc,
+                                    TemplateArgsPtr,
+                                    TemplateId->getTemplateArgLocations(),
+                                    TemplateId->RAngleLoc);
+    ConsumeToken(); // Consume the template-id token
+    return move(Result);
+  }
+
   } // switch.
 
   assert(0 && "The switch was supposed to take care everything.");