<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 4, 2016 at 5:18 PM, Piotr Dziwinski <span dir="ltr"><<a href="mailto:piotrdz@gmail.com" target="_blank">piotrdz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span class=""><br></span>
    As a workaround, you can try a different approach - store additional
    state in your check class and update it on each check() call.<br>
    Then, once you have complete context information about the code you
    want to change, create a full diagnostic with all needed data.<br>
    <br>
    This is actually what I do in some of my checks, especially the
    localizing variables check that I'm still working on:<br>
<a href="https://github.com/piotrdz/clang-tools-extra/blob/master/clang-tidy/readability/LocalizingVariablesCheck.cpp" target="_blank">https://github.com/piotrdz/clang-tools-extra/blob/master/clang-tidy/readability/LocalizingVariablesCheck.cpp</a></div></blockquote><div><br></div><div>Yes this is a good idea, thanks. Sadly I need to do it at the very end (your code seems to be able to trigger output (call diag()) based upon function declaration scope.</div><div><br></div><div>I'm trying out using the destruction of the check class to report all the issues. So, for example:</div><div><br></div><div><div>clang::SourceLocation foo;</div><div><br></div><div>UsingCheck::~UsingCheck() {</div><div>  std::cerr << "** destroy of UsingCheck instance\n";</div><div>  diag(foo, "bogus error for testing");</div><div>}</div></div><div><br></div><div>where I just stash a SourceLocation. The code above works (a simple try-it-out test). I'm not sure if a destructor of a ClangTidyCheck class is allowed to do this.  And I still need to stash SourceLocation and SourceRange objects for this to work.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF">Best regards,<br>
    Piotr Dziwinski<br>
  </div>

</blockquote></div><br><div>Thank you so much for the input, and the cool code pointer.</div>-- <br><div class="gmail_signature">Tim Halloran<br>SureLogic, Inc.<br>5808 Forbes Avenue, Pittsburgh PA 15217-1602<br>(412) 722-3338</div>
</div></div>