This is an archive of the discontinued LLVM Phabricator instance.

Fully qualify template template parameters when printing
ClosedPublic

Authored by dblaikie on Aug 26 2021, 5:05 PM.

Details

Summary

I discovered this quirk when working on some DWARF - AST printing prints
type template parameters fully qualified, but printed template template
parameters the way they were written syntactically, or wholely
unqualified - instead, we should print them consistently with the way we
print type template parameters: fully qualified.

The one place this got weird was for partial specializations like in
ast-print-temp-class.cpp - hence the need for checking for
TemplateNameDependenceScope::DependentInstantiation template template
parameters. (not 100% sure that's the right solution to that, though -
open to ideas)

Diff Detail

Event Timeline

dblaikie created this revision.Aug 26 2021, 5:05 PM
dblaikie requested review of this revision.Aug 26 2021, 5:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 26 2021, 5:05 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

It looks like a strict improvement on printing and most callers using the default args won't need to be updated.

There's one more function call that should be updated:
https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/DumpAST.cpp#L298

Fixing that and the comment and this should be good to go in.

clang/include/clang/AST/TemplateName.h
318–320

Update this comment to reflect the enum.

dblaikie updated this revision to Diff 370086.Sep 1 2021, 3:23 PM

Fix the clang-tools-extra caller, and update the TemplateName::print doc comment

Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 3:24 PM
dblaikie marked an inline comment as done.Sep 1 2021, 3:26 PM

Ping

It looks like a strict improvement on printing and most callers using the default args won't need to be updated.

There's one more function call that should be updated:
https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/DumpAST.cpp#L298

Fixing that and the comment and this should be good to go in.

Ah, thanks for catching that (just running check-clang doesn't catch this, and it doesn't seem like there's a check-clang-tools-extra - any idea if there's something narrower than check-all that would run clang-tools-extra tests?). Updated that caller to preserve the existing unqualified behavior.

clang/include/clang/AST/TemplateName.h
318–320

Oh, for sure, thanks for the pointer!

rtrieu accepted this revision.Sep 2 2021, 2:04 PM

Ping

It looks like a strict improvement on printing and most callers using the default args won't need to be updated.

There's one more function call that should be updated:
https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/DumpAST.cpp#L298

Fixing that and the comment and this should be good to go in.

Ah, thanks for catching that (just running check-clang doesn't catch this, and it doesn't seem like there's a check-clang-tools-extra - any idea if there's something narrower than check-all that would run clang-tools-extra tests?). Updated that caller to preserve the existing unqualified behavior.

I don't know if there is a better way to check. I found it by doing a quick search over the code.

This revision is now accepted and ready to land.Sep 2 2021, 2:04 PM
This revision was automatically updated to reflect the committed changes.
dblaikie marked an inline comment as done.