Page MenuHomePhabricator

[analyzer] Added template argument lists to the Pathdiagnostic output

Authored by Szelethus on May 16 2018, 2:54 AM.



Currently, template parameters are not displayed in the plist output. While developing D45532, I found this very frustrating, because it was difficult to decide whether a constructor works correctly without seeing the exact template parameters.

Diff Detail

rC Clang

Event Timeline

Szelethus created this revision.May 16 2018, 2:54 AM

LGTM provided that nits inline are fixed


Calling ->getASTContext()->getLangOpts() on CXXLangDecl will get you the real thing.


no need for a line break after the closing brace here

This revision is now accepted and ready to land.May 16 2018, 10:52 AM

Thanks for the review!


I looked up CXXLangDecl, but apparently its not a thing. I tried looking in PathDiagnostic.h, and some related files, but I couldn't get that "real" LangOptions anywhere :(

What I could do however, is add a LangOptions field to PathDiagnostic, but I'd rather be sure that I didn't misunderstand you.

What drove me to this solution is that TemplateArgument::dump's implementation does the same, though it is accompanied with a FIXME.


Sorry, I've meant CXXRecordDecl. Replied below.


D->getASTContext().getLangOpts() will get you language option.
BTW clangd autocompletion is very useful for API discovery.

Szelethus updated this revision to Diff 147456.May 18 2018, 2:59 AM

Fixes according to inline comments.

Szelethus marked 5 inline comments as done.EditedMay 18 2018, 3:01 AM

D->getASTContext().getLangOpts() will get you language option.

Oh, yea, right. Woops. Thanks for pointing me in right direction :) Clangd looks great, I'll definitely give it a try.

If you like the patch as it is now, can you commit it for me please? I have no write access.

@Szelethus I can, but since you've had quite a few patches accepted, do you want to just apply for a commit access ?

Cleaned up a testfile.

This revision was automatically updated to reflect the committed changes.