diff options
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 8 | ||||
-rw-r--r-- | test/CodeGen/PR3021-debug-info-and-typeof.c | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 478f862775..08cd129b63 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -363,6 +363,7 @@ CGDebugInfo::getOrCreateFunctionType(QualType type, llvm::CompileUnitDesc *Unit) for (unsigned int i =0; i < FTPro->getNumArgs(); i++) { QualType ParamType = FTPro->getArgType(i); ArgTy = getOrCreateType(ParamType, Unit); + // FIXME: Remove once we support all types. if (ArgTy) Elements.push_back(ArgTy); } } @@ -407,8 +408,11 @@ void CGDebugInfo::getOrCreateRecordType(QualType type, for (int i = 0; i < NumMembers; i++) { FieldDecl *Member = RecDecl->getMember(i); llvm::TypeDesc *MemberTy = getOrCreateType(Member->getType(), Unit); - MemberTy->setOffset(RL.getFieldOffset(i)); - Elements.push_back(MemberTy); + // FIXME: Remove once we support all types. + if (MemberTy) { + MemberTy->setOffset(RL.getFieldOffset(i)); + Elements.push_back(MemberTy); + } } // Fill in the blanks. diff --git a/test/CodeGen/PR3021-debug-info-and-typeof.c b/test/CodeGen/PR3021-debug-info-and-typeof.c new file mode 100644 index 0000000000..607462d5c8 --- /dev/null +++ b/test/CodeGen/PR3021-debug-info-and-typeof.c @@ -0,0 +1,5 @@ +// RUN: clang -o %t --emit-llvm -g %s + +void convert(void) { + struct { typeof(0) f0; } v0; +} |