add proper asmwriter and asmparser support for anonymous functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64953 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index cddb343..abddc59 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -2094,11 +2094,21 @@
       isa<OpaqueType>(RetType))
     return Error(RetTypeLoc, "invalid function return type");
   
-  if (Lex.getKind() != lltok::GlobalVar)
-    return TokError("expected function name");
-  
   LocTy NameLoc = Lex.getLoc();
-  std::string FunctionName = Lex.getStrVal();
+
+  std::string FunctionName;
+  if (Lex.getKind() == lltok::GlobalVar) {
+    FunctionName = Lex.getStrVal();
+  } else if (Lex.getKind() == lltok::GlobalID) {     // @42 is ok.
+    unsigned NameID = Lex.getUIntVal();
+
+    if (NameID != NumberedVals.size())
+      return TokError("function expected to be numbered '%" +
+                      utostr(NumberedVals.size()) + "'");
+  } else {
+    return TokError("expected function name");
+  }
+  
   Lex.Lex();
   
   if (Lex.getKind() != lltok::lparen)