[PATCH] D55069: Extend the CommentVisitor with parameter types

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 30 05:14:50 PST 2018


aaron.ballman added a comment.

In D55069#1313591 <https://reviews.llvm.org/D55069#1313591>, @steveire wrote:

> 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.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55069/new/

https://reviews.llvm.org/D55069





More information about the cfe-commits mailing list