[cfe-commits] r90450 - in /cfe/trunk: lib/CodeGen/CodeGenTypes.cpp test/CodeGenCXX/member-pointer-type-convert.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Dec 3 04:44:31 PST 2009
Author: efriedma
Date: Thu Dec 3 06:44:31 2009
New Revision: 90450
URL: http://llvm.org/viewvc/llvm-project?rev=90450&view=rev
Log:
Fix for PR5659: correct a rather nasty oversight in the type conversion for
member pointer types.
Added:
cfe/trunk/test/CodeGenCXX/member-pointer-type-convert.cpp
Modified:
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=90450&r1=90449&r2=90450&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Thu Dec 3 06:44:31 2009
@@ -379,13 +379,13 @@
// If we ever want to support other ABIs this needs to be abstracted.
QualType ETy = cast<MemberPointerType>(Ty).getPointeeType();
+ const llvm::Type *PtrDiffTy =
+ ConvertTypeRecursive(Context.getPointerDiffType());
if (ETy->isFunctionType()) {
- return llvm::StructType::get(TheModule.getContext(),
- ConvertType(Context.getPointerDiffType()),
- ConvertType(Context.getPointerDiffType()),
+ return llvm::StructType::get(TheModule.getContext(), PtrDiffTy, PtrDiffTy,
NULL);
} else
- return ConvertType(Context.getPointerDiffType());
+ return PtrDiffTy;
}
case Type::TemplateSpecialization:
Added: cfe/trunk/test/CodeGenCXX/member-pointer-type-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/member-pointer-type-convert.cpp?rev=90450&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/member-pointer-type-convert.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/member-pointer-type-convert.cpp Thu Dec 3 06:44:31 2009
@@ -0,0 +1,10 @@
+// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
+
+struct A;
+typedef int A::*param_t;
+struct {
+ const char *name;
+ param_t par;
+} *ptr;
+
+// CHECK: type { i8*, i32 }
More information about the cfe-commits
mailing list