forked from OSchip/llvm-project
				
			Update debug info generation for ObjCObjectPointer changes.
- Previously this would crash on recursive types, and it was also incorrectly stripping off a level of indirection. - I'm not 100% convinced this is all correct, but it should be a monotonic improvment. llvm-svn: 75582
This commit is contained in:
		
							parent
							
								
									b1f9128c72
								
							
						
					
					
						commit
						f5c79709bc
					
				| 
						 | 
					@ -200,6 +200,19 @@ llvm::DIType CGDebugInfo::CreateCVRType(QualType Ty, llvm::DICompileUnit Unit) {
 | 
				
			||||||
                                        0, 0, 0, 0, 0, FromTy);
 | 
					                                        0, 0, 0, 0, 0, FromTy);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					llvm::DIType CGDebugInfo::CreateType(const ObjCObjectPointerType *Ty,
 | 
				
			||||||
 | 
					                                     llvm::DICompileUnit Unit) {
 | 
				
			||||||
 | 
					  llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit);
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					  // Bit size, align and offset of the type.
 | 
				
			||||||
 | 
					  uint64_t Size = M->getContext().getTypeSize(Ty);
 | 
				
			||||||
 | 
					  uint64_t Align = M->getContext().getTypeAlign(Ty);
 | 
				
			||||||
 | 
					                                                                               
 | 
				
			||||||
 | 
					  return DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type, Unit,
 | 
				
			||||||
 | 
					                                        "", llvm::DICompileUnit(),
 | 
				
			||||||
 | 
					                                        0, Size, Align, 0, 0, EltTy);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty,
 | 
					llvm::DIType CGDebugInfo::CreateType(const PointerType *Ty,
 | 
				
			||||||
                                     llvm::DICompileUnit Unit) {
 | 
					                                     llvm::DICompileUnit Unit) {
 | 
				
			||||||
  llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit);
 | 
					  llvm::DIType EltTy = getOrCreateType(Ty->getPointeeType(), Unit);
 | 
				
			||||||
| 
						 | 
					@ -764,11 +777,8 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
 | 
				
			||||||
  case Type::QualifiedName:
 | 
					  case Type::QualifiedName:
 | 
				
			||||||
    // Unsupported types
 | 
					    // Unsupported types
 | 
				
			||||||
    return llvm::DIType();
 | 
					    return llvm::DIType();
 | 
				
			||||||
  case Type::ObjCObjectPointer:   // Encode id<p> in debug info just like id.
 | 
					  case Type::ObjCObjectPointer:
 | 
				
			||||||
    {
 | 
					    return Slot = CreateType(cast<ObjCObjectPointerType>(Ty), Unit);
 | 
				
			||||||
    ObjCObjectPointerType *OPT = cast<ObjCObjectPointerType>(Ty);
 | 
					 | 
				
			||||||
    return Slot = CreateType(OPT->getInterfaceType(), Unit);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  case Type::ObjCQualifiedInterface:  // Drop protocols from interface.
 | 
					  case Type::ObjCQualifiedInterface:  // Drop protocols from interface.
 | 
				
			||||||
  case Type::ObjCInterface: 
 | 
					  case Type::ObjCInterface: 
 | 
				
			||||||
    return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);
 | 
					    return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,6 +56,8 @@ class CGDebugInfo {
 | 
				
			||||||
  llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
 | 
					  llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
 | 
				
			||||||
  llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
 | 
					  llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
 | 
				
			||||||
  llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
 | 
					  llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
 | 
				
			||||||
 | 
					  llvm::DIType CreateType(const ObjCObjectPointerType *Ty, 
 | 
				
			||||||
 | 
					                          llvm::DICompileUnit Unit);
 | 
				
			||||||
  llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);
 | 
					  llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);
 | 
				
			||||||
  llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DICompileUnit U);
 | 
					  llvm::DIType CreateType(const BlockPointerType *Ty, llvm::DICompileUnit U);
 | 
				
			||||||
  llvm::DIType CreateType(const FunctionType *Ty, llvm::DICompileUnit U);
 | 
					  llvm::DIType CreateType(const FunctionType *Ty, llvm::DICompileUnit U);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,3 +16,11 @@
 | 
				
			||||||
@implementation A // Line 15
 | 
					@implementation A // Line 15
 | 
				
			||||||
-(void) m0 {}
 | 
					-(void) m0 {}
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@interface I1 {
 | 
				
			||||||
 | 
					  I1 *iv0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					@end
 | 
				
			||||||
 | 
					void f0(void) {
 | 
				
			||||||
 | 
					  I1 *x;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue