[cfe-commits] r92266 - in /cfe/trunk: lib/CodeGen/CGRTTI.cpp test/CodeGenCXX/rtti-linkage.cpp
Anders Carlsson
andersca at mac.com
Tue Dec 29 12:20:20 PST 2009
Author: andersca
Date: Tue Dec 29 14:20:19 2009
New Revision: 92266
URL: http://llvm.org/viewvc/llvm-project?rev=92266&view=rev
Log:
Fix function type RTTI linkage and add tests.
Modified:
cfe/trunk/lib/CodeGen/CGRTTI.cpp
cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp
Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=92266&r1=92265&r2=92266&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Tue Dec 29 14:20:19 2009
@@ -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());
Modified: cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp?rev=92266&r1=92265&r2=92266&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp Tue Dec 29 14:20:19 2009
@@ -28,6 +28,15 @@
// CHECK: _ZTIN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTSPN12_GLOBAL__N_11DE = internal constant
// CHECK: _ZTIPN12_GLOBAL__N_11DE = internal constant
+// CHECK: _ZTSFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK: _ZTIFN12_GLOBAL__N_11DEvE = internal constant
+// CHECK: _ZTSFvN12_GLOBAL__N_11DEE = internal constant
+// CHECK: _ZTIFvN12_GLOBAL__N_11DEE = internal constant
+
+// CHECK: _ZTSPFvvE = weak_odr constant
+// CHECK: _ZTSFvvE = weak_odr constant
+// CHECK: _ZTIFvvE = weak_odr
+// CHECK: _ZTIPFvvE = weak_odr constant
// A has no key function, so its RTTI data should be weak_odr.
struct A { };
@@ -64,7 +73,13 @@
const std::type_info &t2() {
(void)typeid(const D);
- (void)typeid(D *);
+ (void)typeid(D *);
+ (void)typeid(D (*)());
+ (void)typeid(void (*)(D));
+ // The exception specification is not part of the RTTI descriptor, so it should not have
+ // internal linkage.
+ (void)typeid(void (*)() throw (D));
+
// CHECK: _ZTIN12_GLOBAL__N_11DE to
return typeid(getD());
}
More information about the cfe-commits
mailing list