Make linkage-specifications hold on to all of their declarations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61110 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 81a4abe..b7c8316 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3382,11 +3382,34 @@
   return FileScopeAsmDecl::Create(Context, Loc, AsmString);
 }
 
+  /// ActOnLinkageSpec - Parsed a C++ linkage-specification that
+  /// contained braces. Lang/StrSize contains the language string that
+  /// was parsed at location Loc. Decls/NumDecls provides the
+  /// declarations parsed inside the linkage specification.
 Sema::DeclTy* Sema::ActOnLinkageSpec(SourceLocation Loc,
                                      SourceLocation LBrace,
                                      SourceLocation RBrace,
                                      const char *Lang,
                                      unsigned StrSize,
+                                     DeclTy **Decls, unsigned NumDecls) {
+  LinkageSpecDecl::LanguageIDs Language;
+  if (strncmp(Lang, "\"C\"", StrSize) == 0)
+    Language = LinkageSpecDecl::lang_c;
+  else if (strncmp(Lang, "\"C++\"", StrSize) == 0)
+    Language = LinkageSpecDecl::lang_cxx;
+  else {
+    Diag(Loc, diag::err_bad_language);
+    return 0;
+  }
+
+  // FIXME: Add all the various semantics of linkage specifications
+
+  return LinkageSpecDecl::Create(Context, Loc, Language, 
+                                 (Decl **)Decls, NumDecls);
+}
+
+Sema::DeclTy* Sema::ActOnLinkageSpec(SourceLocation Loc,
+                                     const char *Lang, unsigned StrSize,
                                      DeclTy *D) {
   LinkageSpecDecl::LanguageIDs Language;
   Decl *dcl = static_cast<Decl *>(D);