[cfe-commits] r82745 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h
John McCall
rjmccall at apple.com
Thu Sep 24 18:40:47 PDT 2009
Author: rjmccall
Date: Thu Sep 24 20:40:47 2009
New Revision: 82745
URL: http://llvm.org/viewvc/llvm-project?rev=82745&view=rev
Log:
Fix an infinite loop arising when trying to generate debug information
for a ObjC class with an ivar of weak self type.
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=82745&r1=82744&r2=82745&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Sep 24 20:40:47 2009
@@ -173,28 +173,35 @@
Offset, /*flags*/ 0, Encoding);
}
-/// getOrCreateCVRType - Get the CVR qualified type from the cache or create
+/// CreateCVRType - Get the qualified type from the cache or create
/// a new one if necessary.
-llvm::DIType CGDebugInfo::CreateCVRType(QualType Ty, llvm::DICompileUnit Unit) {
+llvm::DIType CGDebugInfo::CreateQualifiedType(QualType Ty, llvm::DICompileUnit Unit) {
+ QualifierCollector Qc;
+ const Type *T = Qc.strip(Ty);
+
+ // Ignore these qualifiers for now.
+ Qc.removeObjCGCAttr();
+ Qc.removeAddressSpace();
+
// We will create one Derived type for one qualifier and recurse to handle any
// additional ones.
- llvm::DIType FromTy;
unsigned Tag;
- if (Ty.isConstQualified()) {
+ if (Qc.hasConst()) {
Tag = llvm::dwarf::DW_TAG_const_type;
- Ty.removeConst();
- FromTy = getOrCreateType(Ty, Unit);
- } else if (Ty.isVolatileQualified()) {
+ Qc.removeConst();
+ } else if (Qc.hasVolatile()) {
Tag = llvm::dwarf::DW_TAG_volatile_type;
- Ty.removeVolatile();
- FromTy = getOrCreateType(Ty, Unit);
- } else {
- assert(Ty.isRestrictQualified() && "Unknown type qualifier for debug info");
+ Qc.removeVolatile();
+ } else if (Qc.hasRestrict()) {
Tag = llvm::dwarf::DW_TAG_restrict_type;
- Ty.removeRestrict();
- FromTy = getOrCreateType(Ty, Unit);
+ Qc.removeRestrict();
+ } else {
+ assert(Qc.empty() && "Unknown type qualifier for debug info");
+ return getOrCreateType(QualType(T, 0), Unit);
}
+ llvm::DIType FromTy = getOrCreateType(Qc.apply(T), Unit);
+
// No need to fill in the Name, Line, Size, Alignment, Offset in case of
// CVR derived types.
return DebugFactory.CreateDerivedType(Tag, Unit, "", llvm::DICompileUnit(),
@@ -770,9 +777,9 @@
/// new one if necessary.
llvm::DIType CGDebugInfo::CreateTypeNode(QualType Ty,
llvm::DICompileUnit Unit) {
- // Handle CVR qualifiers, which recursively handles what they refer to.
- if (Ty.getCVRQualifiers())
- return CreateCVRType(Ty, Unit);
+ // Handle qualifiers, which recursively handles what they refer to.
+ if (Ty.hasQualifiers())
+ return CreateQualifiedType(Ty, Unit);
// Work out details of type.
switch (Ty->getTypeClass()) {
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=82745&r1=82744&r2=82745&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Sep 24 20:40:47 2009
@@ -59,7 +59,7 @@
/// Helper functions for getOrCreateType.
llvm::DIType CreateType(const BuiltinType *Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
- llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
+ llvm::DIType CreateQualifiedType(QualType Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
llvm::DIType CreateType(const ObjCObjectPointerType *Ty,
llvm::DICompileUnit Unit);
More information about the cfe-commits
mailing list