This has precedent in the StmtVisitor. This change will make it
possible to clean up the comment handling in ASTDumper.
Details
Diff Detail
- Repository
- rC Clang
- Build Status
Buildable 25507 Build 25506: arc lint + arc unit
Event Timeline
Overall this seems reasonable, but this change is currently a no-op because nothing is using this -- what's the plan for using and testing these changes?
include/clang/AST/CommentVisitor.h | ||
---|---|---|
31 | Should this be ParamTys&&... because we're forwarding in the actual call? (Similar below) |
The follow-up patch didn't build anymore with the &&.
../tools/clang/lib/AST/ASTDumper.cpp:2672:75: error: cannot bind rvalue reference of type ‘const clang::comments::FullComment*&&’ to lvalue of type ‘const clang::comments::FullComment* const’ ConstCommentVisitor<ASTDumper, void, const FullComment *>::visit(C, FC);
Huh, that's surprising. It's a perfect forwarding reference and that use would be binding an lvalue reference, not an rvalue reference (I believe -- it's a bit hard to tell given that the patch with the uses is split out). Did you update both visit() and visitComment()? I just noticed that StmtVisitor also does not use perfect forwarding, so perhaps this isn't critical, but I'm curious as to why this doesn't behave as expected. One of the reasons I think this may be important is with the JSON dumper -- it may pass around JSON values rather than references and rely on move semantics to make this work.
Huh, that's surprising. It's a perfect forwarding reference
It's not a forwarding reference because the template parameter is from the record, not the function. See
One of the reasons I think this may be important is with the JSON dumper -- it may pass around JSON values rather than references and rely on move semantics to make this work.
I don't know what you're planning so I can't imagine what you want to pass through these visit function parameters. It would be surprising to me if you used this feature of the visitor for json dumping.
Ah, you're exactly right! I hadn't picked up on that.
One of the reasons I think this may be important is with the JSON dumper -- it may pass around JSON values rather than references and rely on move semantics to make this work.
I don't know what you're planning so I can't imagine what you want to pass through these visit function parameters. It would be surprising to me if you used this feature of the visitor for json dumping.
It can be dealt with if/when it arises.
LGTM!
Should this be ParamTys&&... because we're forwarding in the actual call? (Similar below)