<div dir="ltr">This caused PR15637. I added a test for that bug in <span style="color:rgb(0,0,0);white-space:pre-wrap">r178497 and reverted this CL for now.</span></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Mar 26, 2013 at 3:09 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: dblaikie<br>
Date: Tue Mar 26 17:09:53 2013<br>
New Revision: 178079<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=178079&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=178079&view=rev</a><br>
Log:<br>
Debug Info: remove use of magic numbers to tweak specific debug info metadata fields<br>
<br>
Modified:<br>
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=178079&r1=178078&r2=178079&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=178079&r1=178078&r2=178079&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Mar 26 17:09:53 2013<br>
@@ -392,21 +392,12 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
<br>
llvm::DIType ISATy = DBuilder.createPointerType(ClassTy, Size);<br>
<br>
- llvm::DIType FwdTy =<br>
+ ObjTy =<br>
DBuilder.createStructType(TheCU, "objc_object", getOrCreateMainFile(),<br>
0, 0, 0, 0, llvm::DIType(), llvm::DIArray());<br>
<br>
- llvm::TrackingVH<llvm::MDNode> ObjNode(FwdTy);<br>
- SmallVector<llvm::Value *, 1> EltTys;<br>
- llvm::DIType FieldTy =<br>
- DBuilder.createMemberType(llvm::DIDescriptor(ObjNode), "isa",<br>
- getOrCreateMainFile(), 0, Size,<br>
- 0, 0, 0, ISATy);<br>
- EltTys.push_back(FieldTy);<br>
- llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys);<br>
-<br>
- ObjNode->replaceOperandWith(10, Elements);<br>
- ObjTy = llvm::DIType(ObjNode);<br>
+ ObjTy.setTypeArray(DBuilder.getOrCreateArray(&*DBuilder.createMemberType(<br>
+ ObjTy, "isa", getOrCreateMainFile(), 0, Size, 0, 0, 0, ISATy)));<br>
return ObjTy;<br>
}<br>
case BuiltinType::ObjCSel: {<br>
@@ -1332,15 +1323,16 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
// may refer to the forward decl if the struct is recursive) and replace all<br>
// uses of the forward declaration with the final definition.<br>
<br>
- llvm::DIType FwdDecl = getOrCreateLimitedType(QualType(Ty, 0), DefUnit);<br>
+ llvm::DICompositeType FwdDecl(<br>
+ getOrCreateLimitedType(QualType(Ty, 0), DefUnit));<br>
+ assert(FwdDecl.Verify() &&<br>
+ "The debug type of a RecordType should be a DICompositeType");<br>
<br>
if (FwdDecl.isForwardDecl())<br>
return FwdDecl;<br>
<br>
- llvm::TrackingVH<llvm::MDNode> FwdDeclNode(FwdDecl);<br>
-<br>
// Push the struct on region stack.<br>
- LexicalBlockStack.push_back(FwdDeclNode);<br>
+ LexicalBlockStack.push_back(&*FwdDecl);<br>
RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);<br>
<br>
// Add this to the completed-type cache while we're completing it recursively.<br>
@@ -1374,19 +1366,10 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
RegionMap.erase(Ty->getDecl());<br>
<br>
llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys);<br>
- // FIXME: Magic numbers ahoy! These should be changed when we<br>
- // get some enums in llvm/Analysis/DebugInfo.h to refer to<br>
- // them.<br>
- if (RD->isUnion())<br>
- FwdDeclNode->replaceOperandWith(10, Elements);<br>
- else if (CXXDecl) {<br>
- FwdDeclNode->replaceOperandWith(10, Elements);<br>
- FwdDeclNode->replaceOperandWith(13, TParamsArray);<br>
- } else<br>
- FwdDeclNode->replaceOperandWith(10, Elements);<br>
+ FwdDecl.setTypeArray(Elements, TParamsArray);<br>
<br>
- RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDeclNode);<br>
- return llvm::DIType(FwdDeclNode);<br>
+ RegionMap[Ty->getDecl()] = llvm::WeakVH(FwdDecl);<br>
+ return FwdDecl;<br>
}<br>
<br>
/// CreateType - get objective-c object type.<br>
@@ -1429,7 +1412,7 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
if (ID->getImplementation())<br>
Flags |= llvm::DIDescriptor::FlagObjcClassComplete;<br>
<br>
- llvm::DIType RealDecl =<br>
+ llvm::DICompositeType RealDecl =<br>
DBuilder.createStructType(Unit, ID->getName(), DefUnit,<br>
Line, Size, Align, Flags,<br>
llvm::DIType(), llvm::DIArray(), RuntimeLang);<br>
@@ -1439,9 +1422,8 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
QualType QualTy = QualType(Ty, 0);<br>
CompletedTypeCache[QualTy.getAsOpaquePtr()] = RealDecl;<br>
// Push the struct on region stack.<br>
- llvm::TrackingVH<llvm::MDNode> FwdDeclNode(RealDecl);<br>
<br>
- LexicalBlockStack.push_back(FwdDeclNode);<br>
+ LexicalBlockStack.push_back(static_cast<llvm::MDNode*>(RealDecl));<br>
RegionMap[Ty->getDecl()] = llvm::WeakVH(RealDecl);<br>
<br>
// Convert all the elements.<br>
@@ -1561,7 +1543,7 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
}<br>
<br>
llvm::DIArray Elements = DBuilder.getOrCreateArray(EltTys);<br>
- FwdDeclNode->replaceOperandWith(10, Elements);<br>
+ RealDecl.setTypeArray(Elements);<br>
<br>
// If the implementation is not yet set, we do not want to mark it<br>
// as complete. An implementation may declare additional<br>
@@ -1570,7 +1552,7 @@ llvm::DIType CGDebugInfo::CreateType(con<br>
CompletedTypeCache.erase(QualTy.getAsOpaquePtr());<br>
<br>
LexicalBlockStack.pop_back();<br>
- return llvm::DIType(FwdDeclNode);<br>
+ return RealDecl;<br>
}<br>
<br>
llvm::DIType CGDebugInfo::CreateType(const VectorType *Ty, llvm::DIFile Unit) {<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=178079&r1=178078&r2=178079&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=178079&r1=178078&r2=178079&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Mar 26 17:09:53 2013<br>
@@ -51,7 +51,7 @@ class CGDebugInfo {<br>
SourceLocation CurLoc, PrevLoc;<br>
llvm::DIType VTablePtrType;<br>
llvm::DIType ClassTy;<br>
- llvm::DIType ObjTy;<br>
+ llvm::DICompositeType ObjTy;<br>
llvm::DIType SelTy;<br>
llvm::DIType OCLImage1dDITy, OCLImage1dArrayDITy, OCLImage1dBufferDITy;<br>
llvm::DIType OCLImage2dDITy, OCLImage2dArrayDITy;<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>