<div dir="ltr"><br><div>How about setElementsAndTemplates for now?</div><div><br></div><div>Manman</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 29, 2014 at 9:38 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Jul 29, 2014 at 9:35 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
> On Mon, Jul 28, 2014 at 4:13 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:<br>
>> On Mon, Jul 28, 2014 at 12:14 PM, Manman Ren <<a href="mailto:manman.ren@gmail.com">manman.ren@gmail.com</a>> wrote:<br>
>>> Author: mren<br>
>>> Date: Mon Jul 28 14:14:13 2014<br>
>>> New Revision: 214112<br>
>>><br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=214112&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=214112&view=rev</a><br>
>>> Log:<br>
>>> [Debug Info] rename getTypeArray to getElements, setTypeArray to setArrays.<br>
>>><br>
>>> This is the second of a series of patches to handle type uniqueing of the<br>
>>> type array for a subroutine type.<br>
>>><br>
>>> For vector and array types, getElements returns the array of subranges, so it<br>
>>> is a better name than getTypeArray. Even for class, struct and enum types,<br>
>>> getElements returns the members, which can be subprograms.<br>
>>><br>
>>> setArrays can set up to two arrays, the second is the templates.<br>
>><br>
>> setArrays as a name seems to be a bit lacking in descriptive power.<br>
>> Can you perhaps either split the routine or maybe "setElements" or<br>
>> something?<br>
><br>
> I had the same thought, though I'm not sure setElements is an<br>
> improvement. It would be at least symmetric with getElements (except<br>
> that setArrays sets two different arrays). Probably splitting it into<br>
> two and naming them setElements and setTemplateArguments would make<br>
> the most sense for now. Maybe "elements" can be made more precise<br>
> later if we figure out something better.<br>
><br>
> The "elements" list includes base classes, fields, and member<br>
> functions - so it's a bit of a grab bag (& maybe other things for<br>
> other types? The subscripts in an array, is it?), hard to have a very<br>
> precise name.<br>
><br>
<br>
</div></div>Yeah, my "big" function naming issue was setArrays. Not that it wasn't<br>
like that before, but... sounds like we agree though.<br>
<span class="HOEnZb"><font color="#888888"><br>
-eric<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
>> Just thinking out loud, but it's not very clear.<br>
>><br>
>> -eric<br>
>><br>
>>><br>
>>> This commit should have no functionality change.<br>
>>><br>
>>> Modified:<br>
>>> llvm/trunk/include/llvm/IR/DebugInfo.h<br>
>>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>>> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
>>> llvm/trunk/lib/IR/DebugInfo.cpp<br>
>>> llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp<br>
>>><br>
>>> Modified: llvm/trunk/include/llvm/IR/DebugInfo.h<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=214112&r1=214111&r2=214112&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=214112&r1=214111&r2=214112&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/include/llvm/IR/DebugInfo.h (original)<br>
>>> +++ llvm/trunk/include/llvm/IR/DebugInfo.h Mon Jul 28 14:14:13 2014<br>
>>> @@ -425,8 +425,8 @@ class DICompositeType : public DIDerived<br>
>>> public:<br>
>>> explicit DICompositeType(const MDNode *N = nullptr) : DIDerivedType(N) {}<br>
>>><br>
>>> - DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }<br>
>>> - void setTypeArray(DIArray Elements, DIArray TParams = DIArray());<br>
>>> + DIArray getElements() const { return getFieldAs<DIArray>(10); }<br>
>>> + void setArrays(DIArray Elements, DIArray TParams = DIArray());<br>
>>> unsigned getRunTimeLang() const { return getUnsignedField(11); }<br>
>>> DITypeRef getContainingType() const { return getFieldAs<DITypeRef>(12); }<br>
>>> void setContainingType(DICompositeType ContainingType);<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=214112&r1=214111&r2=214112&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=214112&r1=214111&r2=214112&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Jul 28 14:14:13 2014<br>
>>> @@ -150,7 +150,7 @@ DIType DbgVariable::getType() const {<br>
>>> if (tag == dwarf::DW_TAG_pointer_type)<br>
>>> subType = resolve(DIDerivedType(Ty).getTypeDerivedFrom());<br>
>>><br>
>>> - DIArray Elements = DICompositeType(subType).getTypeArray();<br>
>>> + DIArray Elements = DICompositeType(subType).getElements();<br>
>>> for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {<br>
>>> DIDerivedType DT(Elements.getElement(i));<br>
>>> if (getName() == DT.getName())<br>
>>> @@ -468,7 +468,7 @@ DIE *DwarfDebug::createScopeChildrenDIE(<br>
>>><br>
>>> // If this is a variadic function, add an unspecified parameter.<br>
>>> DISubprogram SP(Scope->getScopeNode());<br>
>>> - DIArray FnArgs = SP.getType().getTypeArray();<br>
>>> + DIArray FnArgs = SP.getType().getElements();<br>
>>> if (FnArgs.getElement(FnArgs.getNumElements() - 1)<br>
>>> .isUnspecifiedParameter()) {<br>
>>> Children.push_back(<br>
>>><br>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=214112&r1=214111&r2=214112&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=214112&r1=214111&r2=214112&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)<br>
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Mon Jul 28 14:14:13 2014<br>
>>> @@ -690,7 +690,7 @@ void DwarfUnit::addBlockByrefAddress(con<br>
>>><br>
>>> // Find the __forwarding field and the variable field in the __Block_byref<br>
>>> // struct.<br>
>>> - DIArray Fields = blockStruct.getTypeArray();<br>
>>> + DIArray Fields = blockStruct.getElements();<br>
>>> DIDerivedType varField;<br>
>>> DIDerivedType forwardingField;<br>
>>><br>
>>> @@ -1161,7 +1161,7 @@ void DwarfUnit::constructTypeDIE(DIE &Bu<br>
>>> break;<br>
>>> case dwarf::DW_TAG_subroutine_type: {<br>
>>> // Add return type. A void return won't have a type.<br>
>>> - DIArray Elements = CTy.getTypeArray();<br>
>>> + DIArray Elements = CTy.getElements();<br>
>>> DIType RTy(Elements.getElement(0));<br>
>>> if (RTy)<br>
>>> addType(Buffer, RTy);<br>
>>> @@ -1191,7 +1191,7 @@ void DwarfUnit::constructTypeDIE(DIE &Bu<br>
>>> case dwarf::DW_TAG_union_type:<br>
>>> case dwarf::DW_TAG_class_type: {<br>
>>> // Add elements to structure type.<br>
>>> - DIArray Elements = CTy.getTypeArray();<br>
>>> + DIArray Elements = CTy.getElements();<br>
>>> for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {<br>
>>> DIDescriptor Element = Elements.getElement(i);<br>
>>> if (Element.isSubprogram())<br>
>>> @@ -1456,7 +1456,7 @@ void DwarfUnit::applySubprogramAttribute<br>
>>> assert(SPTy.getTag() == dwarf::DW_TAG_subroutine_type &&<br>
>>> "the type of a subprogram should be a subroutine");<br>
>>><br>
>>> - DIArray Args = SPTy.getTypeArray();<br>
>>> + DIArray Args = SPTy.getElements();<br>
>>> // Add a return type. If this is a type like a C/C++ void type we don't add a<br>
>>> // return type.<br>
>>> if (Args.getElement(0))<br>
>>> @@ -1740,7 +1740,7 @@ void DwarfUnit::constructArrayTypeDIE(DI<br>
>>> }<br>
>>><br>
>>> // Add subranges to array type.<br>
>>> - DIArray Elements = CTy.getTypeArray();<br>
>>> + DIArray Elements = CTy.getElements();<br>
>>> for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {<br>
>>> DIDescriptor Element = Elements.getElement(i);<br>
>>> if (Element.getTag() == dwarf::DW_TAG_subrange_type)<br>
>>> @@ -1750,7 +1750,7 @@ void DwarfUnit::constructArrayTypeDIE(DI<br>
>>><br>
>>> /// constructEnumTypeDIE - Construct an enum type DIE from DICompositeType.<br>
>>> void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, DICompositeType CTy) {<br>
>>> - DIArray Elements = CTy.getTypeArray();<br>
>>> + DIArray Elements = CTy.getElements();<br>
>>><br>
>>> // Add enumerators to enumeration type.<br>
>>> for (unsigned i = 0, N = Elements.getNumElements(); i < N; ++i) {<br>
>>><br>
>>> Modified: llvm/trunk/lib/IR/DebugInfo.cpp<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=214112&r1=214111&r2=214112&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=214112&r1=214111&r2=214112&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)<br>
>>> +++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Jul 28 14:14:13 2014<br>
>>> @@ -676,7 +676,7 @@ static void VerifySubsetOf(const MDNode<br>
>>> #endif<br>
>>><br>
>>> /// \brief Set the array of member DITypes.<br>
>>> -void DICompositeType::setTypeArray(DIArray Elements, DIArray TParams) {<br>
>>> +void DICompositeType::setArrays(DIArray Elements, DIArray TParams) {<br>
>>> assert((!TParams || DbgNode->getNumOperands() == 15) &&<br>
>>> "If you're setting the template parameters this should include a slot "<br>
>>> "for that!");<br>
>>> @@ -1064,7 +1064,7 @@ void DebugInfoFinder::processType(DIType<br>
>>> if (DT.isCompositeType()) {<br>
>>> DICompositeType DCT(DT);<br>
>>> processType(DCT.getTypeDerivedFrom().resolve(TypeIdentifierMap));<br>
>>> - DIArray DA = DCT.getTypeArray();<br>
>>> + DIArray DA = DCT.getElements();<br>
>>> for (unsigned i = 0, e = DA.getNumElements(); i != e; ++i) {<br>
>>> DIDescriptor D = DA.getElement(i);<br>
>>> if (D.isType())<br>
>>> @@ -1347,7 +1347,7 @@ void DIDerivedType::printInternal(raw_os<br>
>>><br>
>>> void DICompositeType::printInternal(raw_ostream &OS) const {<br>
>>> DIType::printInternal(OS);<br>
>>> - DIArray A = getTypeArray();<br>
>>> + DIArray A = getElements();<br>
>>> OS << " [" << A.getNumElements() << " elements]";<br>
>>> }<br>
>>><br>
>>><br>
>>> Modified: llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp?rev=214112&r1=214111&r2=214112&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp?rev=214112&r1=214111&r2=214112&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp (original)<br>
>>> +++ llvm/trunk/lib/Transforms/Instrumentation/DebugIR.cpp Mon Jul 28 14:14:13 2014<br>
>>> @@ -396,7 +396,7 @@ private:<br>
>>> Elements.push_back(getOrCreateType(T->getStructElementType(i)));<br>
>>><br>
>>> // set struct elements<br>
>>> - StructDescriptor.setTypeArray(Builder.getOrCreateArray(Elements));<br>
>>> + StructDescriptor.setArrays(Builder.getOrCreateArray(Elements));<br>
>>> } else if (T->isPointerTy()) {<br>
>>> Type *PointeeTy = T->getPointerElementType();<br>
>>> if (!(N = getType(PointeeTy)))<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>