Fix function type RTTI linkage and add tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92266 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGRTTI.cpp b/lib/CodeGen/CGRTTI.cpp
index 937a442..fc1098c 100644
--- a/lib/CodeGen/CGRTTI.cpp
+++ b/lib/CodeGen/CGRTTI.cpp
@@ -365,11 +365,10 @@
 
     case Type::Pointer:
     case Type::MemberPointer:
-      return BuildTypeInfo(Ty);
-
     case Type::FunctionProto:
     case Type::FunctionNoProto:
-      return BuildSimpleType(Ty, "_ZTVN10__cxxabiv120__function_type_infoE");
+      return BuildTypeInfo(Ty);
+
     case Type::ConstantArray:
     case Type::IncompleteArray:
     case Type::VariableArray:
@@ -681,8 +680,13 @@
     break;
   case Type::MemberPointer:
     // abi::__pointer_to_member_type_info
-    VtableName =  "_ZTVN10__cxxabiv129__pointer_to_member_type_infoE";
+    VtableName = "_ZTVN10__cxxabiv129__pointer_to_member_type_infoE";
     break;
+  
+  case Type::FunctionNoProto:
+  case Type::FunctionProto:
+    // abi::__function_type_info
+    VtableName = "_ZTVN10__cxxabiv120__function_type_infoE";
   }
 
   llvm::Constant *Vtable = 
@@ -730,6 +734,12 @@
     assert(false && "Builtin type info must be in the standard library!");
     break;
 
+  case Type::FunctionNoProto:
+  case Type::FunctionProto:
+    // Itanium C++ ABI 2.9.5p4:
+    // abi::__function_type_info adds no data members to std::type_info;
+    break;
+
   case Type::Record: {
     const CXXRecordDecl *RD = 
       cast<CXXRecordDecl>(cast<RecordType>(Ty)->getDecl());