<div dir="ltr">I'd probably start by analyzing the bug, maybe figuring out the root cause - then work backwards for the test case to commit along with the test. (figuring out the root cause might reveal easier ways to reproduce the bug, once it's understood)<br><br>To root cause the bug, I'd try parallel debugging sessions - with and without a compilation DB, for instance - stepping through each, and seeing where the behavior diverges, and why it diverges.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 6, 2021 at 3:33 PM Oleg Smolsky via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Folks, I'm trying understand a `clang-tidy` bug where the 'modernize-use-default-member-init' check misbehaves on this (reduced) input:</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">struct Thing {</div><div dir="ltr">    Thing(int arg) : a(arg), b(0) {}</div><div dir="ltr">    int a, b;</div><div dir="ltr">};</div><div dir="ltr"><br></div><div>The check works correctly when running `clang-tidy` without a compilation DB. The tool complains, but works correctly. Things also work correctly in the LIT tests... </div><div><br></div><div>Yet when running with a compilation DB, I get this output after fixes are applied (notice the trailing comma, which makes the code ill-formed):</div><div><br></div><div><div>struct Thing {</div><div>    Thing(int arg) : a(arg), {}</div><div>    int a, b{0};</div><div>};</div></div><div><br></div><div>How do I write a unit test for this? I mean how do I create a reliable repro?</div><div><br></div><div>Thanks,<br>Oleg.</div></div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>