<div dir="ltr">Done in r<span style="font-family:monospace"> 263396</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 13, 2016 at 2:48 PM, Mehdi Amini via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Amjad,<br>
<div><div class="h5"><br>
> On Mar 13, 2016, at 4:11 AM, Amjad Aboud via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: aaboud<br>
> Date: Sun Mar 13 06:11:39 2016<br>
> New Revision: 263379<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=263379&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=263379&view=rev</a><br>
> Log:<br>
> Fixed DIBuilder to verify that same imported entity will not be added twice to the "imports" list of the DICompileUnit.<br>
><br>
> Differential Revision: <a href="http://reviews.llvm.org/D17884" rel="noreferrer" target="_blank">http://reviews.llvm.org/D17884</a><br>
><br>
> Modified:<br>
> llvm/trunk/lib/IR/DIBuilder.cpp<br>
> llvm/trunk/unittests/IR/IRBuilderTest.cpp<br>
><br>
> Modified: llvm/trunk/lib/IR/DIBuilder.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=263379&r1=263378&r2=263379&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=263379&r1=263378&r2=263379&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/IR/DIBuilder.cpp (original)<br>
> +++ llvm/trunk/lib/IR/DIBuilder.cpp Sun Mar 13 06:11:39 2016<br>
> @@ -19,6 +19,7 @@<br>
> #include "llvm/IR/Module.h"<br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/Dwarf.h"<br>
> +#include "LLVMContextImpl.h"<br>
><br>
> using namespace llvm;<br>
> using namespace llvm::dwarf;<br>
> @@ -168,8 +169,12 @@ static DIImportedEntity *<br>
> createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context,<br>
> Metadata *NS, unsigned Line, StringRef Name,<br>
> SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {<br>
> + unsigned EntitiesCount = C.pImpl->DIImportedEntitys.size();<br>
> auto *M = DIImportedEntity::get(C, Tag, Context, DINodeRef(NS), Line, Name);<br>
> - AllImportedModules.emplace_back(M);<br>
> + if (EntitiesCount < C.pImpl->DIImportedEntitys.size())<br>
> + // A new Imported Entity was just added to the context.<br>
> + // Add it to the Imported Modules list.<br>
> + AllImportedModules.emplace_back(M);<br>
> return M;<br>
> }<br>
><br>
><br>
> Modified: llvm/trunk/unittests/IR/IRBuilderTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=263379&r1=263378&r2=263379&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=263379&r1=263378&r2=263379&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/IR/IRBuilderTest.cpp (original)<br>
> +++ llvm/trunk/unittests/IR/IRBuilderTest.cpp Sun Mar 13 06:11:39 2016<br>
> @@ -418,4 +418,19 @@ TEST_F(IRBuilderTest, DebugLoc) {<br>
><br>
> DIB.finalize();<br>
> }<br>
> +<br>
> +TEST_F(IRBuilderTest, DIImportedEntity) {<br>
> + IRBuilder<> Builder(BB);<br>
> + DIBuilder DIB(*M);<br>
> + auto File = DIB.createFile("F.CBL", "/");<br>
> + auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, "F.CBL", "/",<br>
> + "llvm-cobol74", true, "", 0);<br>
> + auto IE1 = DIB.createImportedDeclaration(CU, nullptr, 1);<br>
> + auto IE2 = DIB.createImportedDeclaration(CU, nullptr, 1);<br>
> + auto IE3 = DIB.createImportedModule(CU, (DIImportedEntity*)nullptr, 2);<br>
> + auto IE4 = DIB.createImportedModule(CU, (DIImportedEntity*)nullptr, 2);<br>
<br>
<br>
</div></div>This triggers many warnings for unused variables, can you fix it please?<br>
<br>
Thanks,<br>
<br>
Mehdi<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
> + DIB.finalize();<br>
> + EXPECT_TRUE(verifyModule(*M));<br>
> + EXPECT_TRUE(CU->getImportedEntities().size() == 2);<br>
> +}<br>
> }<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>