Parse extern templates, pass that information all the way to Sema,
then drop it on the floor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80989 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 36d5db5..8572d32 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -391,6 +391,7 @@
 /// [C++0x] empty-declaration:
 ///           ';'
 ///
+/// [C++0x/GNU] 'extern' 'template' declaration
 Parser::DeclGroupPtrTy Parser::ParseExternalDeclaration() {
   DeclPtrTy SingleDecl;
   switch (Tok.getKind()) {
@@ -452,6 +453,20 @@
       SourceLocation DeclEnd;
       return ParseDeclaration(Declarator::FileContext, DeclEnd);
     }
+  case tok::kw_extern:
+    if (getLang().CPlusPlus && NextToken().is(tok::kw_template)) {
+      // Extern templates
+      SourceLocation ExternLoc = ConsumeToken();
+      SourceLocation TemplateLoc = ConsumeToken();
+      SourceLocation DeclEnd;
+      return Actions.ConvertDeclToDeclGroup(
+                  ParseExplicitInstantiation(ExternLoc, TemplateLoc, DeclEnd));
+    }
+    
+    // FIXME: Detect C++ linkage specifications here?
+      
+    // Fall through to handle other declarations or function definitions.
+      
   default:
     // We can't tell whether this is a function-definition or declaration yet.
     return ParseDeclarationOrFunctionDefinition();