[llvm] r201747 - Add support for hashing DW_FORM_sdata and a small testcase.
Eric Christopher
echristo at gmail.com
Fri Apr 25 13:34:54 PDT 2014
I think Dave got these, either way, any leaks in the testcase were an
accident at the time :)
-eric
On Thu, Apr 24, 2014 at 2:54 AM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
> Excuse me, I missed r201749. It was now MemberSdata.
>
> IntTyDIE and PITyDIE are leaking here.
> FloatTyDIE, PITyDIE, and PIBlock were added in r201752, MemberBlock.
>
> Although I could add deleting them, would they be managed in future?
>
> 2014-04-24 17:57 GMT+09:00 NAKAMURA Takumi <geek4civic at gmail.com>:
>> In DIEHashTest::MemberBlock,
>>
>> FloatTyDIE, PITyDIE, and PIBlock are leaking. Will they be managed or
>> deleted there?
>>
>> 2014-02-20 9:54 GMT+09:00 Eric Christopher <echristo at gmail.com>:
>>> Author: echristo
>>> Date: Wed Feb 19 18:54:40 2014
>>> New Revision: 201747
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=201747&view=rev
>>> Log:
>>> Add support for hashing DW_FORM_sdata and a small testcase.
>>>
>>> Modified:
>>> llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
>>> llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
>>>
>>> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=201747&r1=201746&r2=201747&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
>>> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Wed Feb 19 18:54:40 2014
>>> @@ -306,6 +306,7 @@ void DIEHash::hashAttribute(AttrEntry At
>>> case dwarf::DW_FORM_data4:
>>> case dwarf::DW_FORM_data8:
>>> case dwarf::DW_FORM_udata:
>>> + case dwarf::DW_FORM_sdata:
>>> addULEB128('A');
>>> addULEB128(Attribute);
>>> addULEB128(dwarf::DW_FORM_sdata);
>>>
>>> Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=201747&r1=201746&r2=201747&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)
>>> +++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Wed Feb 19 18:54:40 2014
>>> @@ -549,4 +549,51 @@ TEST(DIEHashTest, MemberFuncFlag) {
>>> // The exact same hash GCC produces for this DIE.
>>> ASSERT_EQ(0x8f78211ddce3df10ULL, MD5Res);
>>> }
>>> +
>>> +// Derived from:
>>> +// struct A {
>>> +// const static float PI = 3.14f;
>>> +// };
>>> +// A a;
>>> +TEST(DIEHashTest, MemberBlock) {
>>> + DIE A(dwarf::DW_TAG_structure_type);
>>> + DIEInteger One(1);
>>> + DIEString AStr(&One, "A");
>>> + A.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &AStr);
>>> + A.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);
>>> + A.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One);
>>> + A.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &One);
>>> +
>>> + DIEInteger Four(4);
>>> + DIEInteger Five(5);
>>> + DIEString FStr(&One, "int");
>>> + DIE *IntTyDIE = new DIE(dwarf::DW_TAG_base_type);
>>> + IntTyDIE->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);
>>> + IntTyDIE->addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five);
>>> + IntTyDIE->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FStr);
>>> +
>>> + DIEEntry IntTy(IntTyDIE);
>>> + DIE *PITyDIE = new DIE(dwarf::DW_TAG_const_type);
>>> + PITyDIE->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntTy);
>>> +
>>> + DIEEntry PITy(PITyDIE);
>>> + DIE *PI = new DIE(dwarf::DW_TAG_member);
>>> + DIEString PIStr(&One, "PI");
>>> + DIEInteger Two(2);
>>> + DIEInteger NegThree(-3);
>>> + PI->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &PIStr);
>>> + PI->addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One);
>>> + PI->addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &Two);
>>> + PI->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &PITy);
>>> + PI->addValue(dwarf::DW_AT_external, dwarf::DW_FORM_flag_present, &One);
>>> + PI->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);
>>> + PI->addValue(dwarf::DW_AT_const_value, dwarf::DW_FORM_sdata, &NegThree);
>>> +
>>> + A.addChild(PI);
>>> +
>>> + A.dump();
>>> +
>>> + uint64_t MD5Res = DIEHash().computeTypeSignature(A);
>>> + ASSERT_EQ(0x9a216000dd3788a7ULL, MD5Res);
>>> +}
>>> }
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list