]> granicus.if.org Git - clang/commitdiff
Update debug info type cache after fwd decl is replaced by real decl.
authorDevang Patel <dpatel@apple.com>
Mon, 13 Jul 2009 17:03:14 +0000 (17:03 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 13 Jul 2009 17:03:14 +0000 (17:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75473 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenObjC/PR4541.m [new file with mode: 0644]

index 9bab926977250876bfd864e0b1ab94c4592c941c..3d7417df30e9e1d25327f9da1a8254d99faba641 100644 (file)
@@ -501,7 +501,9 @@ llvm::DIType CGDebugInfo::CreateType(const RecordType *Ty,
   // old decl with the new one.  This will recursively update the debug info.
   FwdDecl.getGV()->replaceAllUsesWith(RealDecl.getGV());
   FwdDecl.getGV()->eraseFromParent();
-  
+
+  // Update TypeCache.
+  TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = RealDecl;  
   return RealDecl;
 }
 
@@ -626,7 +628,9 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
   // old decl with the new one.  This will recursively update the debug info.
   FwdDecl.getGV()->replaceAllUsesWith(RealDecl.getGV());
   FwdDecl.getGV()->eraseFromParent();
-  
+
+  // Update TypeCache.
+  TypeCache[QualType(Ty, 0).getAsOpaquePtr()] = RealDecl;  
   return RealDecl;
 }
 
diff --git a/test/CodeGenObjC/PR4541.m b/test/CodeGenObjC/PR4541.m
new file mode 100644 (file)
index 0000000..9a65116
--- /dev/null
@@ -0,0 +1,19 @@
+// RUN: clang-cc -o %t -w  -g %s
+
+
+@class NSString;
+@interface NSAttributedString 
+- (NSString *)string;
+@end 
+@interface NSMutableAttributedString : NSAttributedString 
+@end 
+@class NSImage;
+@implementation CYObjectsController 
++ (void)initialize {
+}
++ (NSAttributedString *)attributedStringWithString:(id)string image:(NSImage *)image  {
+  NSMutableAttributedString *attrStr;
+}
+@end
+
+