steveire updated this revision to Diff 175966.
steveire added a comment.

Remove &&


Repository:
  rC Clang

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

https://reviews.llvm.org/D55070

Files:
  include/clang/AST/CommentVisitor.h
  lib/AST/ASTDumper.cpp

Index: lib/AST/ASTDumper.cpp
===================================================================
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -109,8 +109,11 @@
   };
 
   class ASTDumper
-      : public ConstDeclVisitor<ASTDumper>, public ConstStmtVisitor<ASTDumper>,
-        public ConstCommentVisitor<ASTDumper>, public TypeVisitor<ASTDumper> {
+      : public ConstDeclVisitor<ASTDumper>,
+        public ConstStmtVisitor<ASTDumper>,
+        public ConstCommentVisitor<ASTDumper, void, const FullComment *>,
+        public TypeVisitor<ASTDumper> {
+
     raw_ostream &OS;
     const CommandTraits *Traits;
     const SourceManager *SM;
@@ -139,9 +142,6 @@
     const char *LastLocFilename = "";
     unsigned LastLocLine = ~0U;
 
-    /// The \c FullComment parent of the comment being dumped.
-    const FullComment *FC = nullptr;
-
     const bool ShowColors;
 
     /// Dump a child of the current node.
@@ -161,8 +161,7 @@
         return;
       }
 
-      const FullComment *OrigFC = FC;
-      auto dumpWithIndent = [this, doDumpChild, OrigFC](bool isLastChild) {
+      auto dumpWithIndent = [this, doDumpChild](bool isLastChild) {
         // Print out the appropriate tree structure and work out the prefix for
         // children of this node. For instance:
         //
@@ -186,7 +185,6 @@
         FirstChild = true;
         unsigned Depth = Pending.size();
 
-        FC = OrigFC;
         doDumpChild();
 
         // If any children are left, they're the last at their nesting level.
@@ -586,21 +584,30 @@
 
     // Comments.
     const char *getCommandName(unsigned CommandID);
-    void dumpComment(const Comment *C);
+    void dumpComment(const Comment *C, const FullComment *FC);
 
     // Inline comments.
-    void visitTextComment(const TextComment *C);
-    void visitInlineCommandComment(const InlineCommandComment *C);
-    void visitHTMLStartTagComment(const HTMLStartTagComment *C);
-    void visitHTMLEndTagComment(const HTMLEndTagComment *C);
+    void visitTextComment(const TextComment *C, const FullComment *FC);
+    void visitInlineCommandComment(const InlineCommandComment *C,
+                                   const FullComment *FC);
+    void visitHTMLStartTagComment(const HTMLStartTagComment *C,
+                                  const FullComment *FC);
+    void visitHTMLEndTagComment(const HTMLEndTagComment *C,
+                                const FullComment *FC);
 
     // Block comments.
-    void visitBlockCommandComment(const BlockCommandComment *C);
-    void visitParamCommandComment(const ParamCommandComment *C);
-    void visitTParamCommandComment(const TParamCommandComment *C);
-    void visitVerbatimBlockComment(const VerbatimBlockComment *C);
-    void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C);
-    void visitVerbatimLineComment(const VerbatimLineComment *C);
+    void visitBlockCommandComment(const BlockCommandComment *C,
+                                  const FullComment *FC);
+    void visitParamCommandComment(const ParamCommandComment *C,
+                                  const FullComment *FC);
+    void visitTParamCommandComment(const TParamCommandComment *C,
+                                   const FullComment *FC);
+    void visitVerbatimBlockComment(const VerbatimBlockComment *C,
+                                   const FullComment *FC);
+    void visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C,
+                                       const FullComment *FC);
+    void visitVerbatimLineComment(const VerbatimLineComment *C,
+                                  const FullComment *FC);
   };
 }
 
@@ -2645,13 +2652,10 @@
 void ASTDumper::dumpFullComment(const FullComment *C) {
   if (!C)
     return;
-
-  FC = C;
-  dumpComment(C);
-  FC = nullptr;
+  dumpComment(C, C);
 }
 
-void ASTDumper::dumpComment(const Comment *C) {
+void ASTDumper::dumpComment(const Comment *C, const FullComment *FC) {
   dumpChild([=] {
     if (!C) {
       ColorScope Color(OS, ShowColors, NullColor);
@@ -2665,18 +2669,19 @@
     }
     dumpPointer(C);
     dumpSourceRange(C->getSourceRange());
-    ConstCommentVisitor<ASTDumper>::visit(C);
+    ConstCommentVisitor<ASTDumper, void, const FullComment *>::visit(C, FC);
     for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
          I != E; ++I)
-      dumpComment(*I);
+      dumpComment(*I, FC);
   });
 }
 
-void ASTDumper::visitTextComment(const TextComment *C) {
+void ASTDumper::visitTextComment(const TextComment *C, const FullComment *) {
   OS << " Text=\"" << C->getText() << "\"";
 }
 
-void ASTDumper::visitInlineCommandComment(const InlineCommandComment *C) {
+void ASTDumper::visitInlineCommandComment(const InlineCommandComment *C,
+                                          const FullComment *) {
   OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
   switch (C->getRenderKind()) {
   case InlineCommandComment::RenderNormal:
@@ -2697,7 +2702,8 @@
     OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
 }
 
-void ASTDumper::visitHTMLStartTagComment(const HTMLStartTagComment *C) {
+void ASTDumper::visitHTMLStartTagComment(const HTMLStartTagComment *C,
+                                         const FullComment *) {
   OS << " Name=\"" << C->getTagName() << "\"";
   if (C->getNumAttrs() != 0) {
     OS << " Attrs: ";
@@ -2710,17 +2716,20 @@
     OS << " SelfClosing";
 }
 
-void ASTDumper::visitHTMLEndTagComment(const HTMLEndTagComment *C) {
+void ASTDumper::visitHTMLEndTagComment(const HTMLEndTagComment *C,
+                                       const FullComment *) {
   OS << " Name=\"" << C->getTagName() << "\"";
 }
 
-void ASTDumper::visitBlockCommandComment(const BlockCommandComment *C) {
+void ASTDumper::visitBlockCommandComment(const BlockCommandComment *C,
+                                         const FullComment *) {
   OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
   for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
     OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
 }
 
-void ASTDumper::visitParamCommandComment(const ParamCommandComment *C) {
+void ASTDumper::visitParamCommandComment(const ParamCommandComment *C,
+                                         const FullComment *FC) {
   OS << " " << ParamCommandComment::getDirectionAsString(C->getDirection());
 
   if (C->isDirectionExplicit())
@@ -2739,7 +2748,8 @@
     OS << " ParamIndex=" << C->getParamIndex();
 }
 
-void ASTDumper::visitTParamCommandComment(const TParamCommandComment *C) {
+void ASTDumper::visitTParamCommandComment(const TParamCommandComment *C,
+                                          const FullComment *FC) {
   if (C->hasParamName()) {
     if (C->isPositionValid())
       OS << " Param=\"" << C->getParamName(FC) << "\"";
@@ -2758,17 +2768,19 @@
   }
 }
 
-void ASTDumper::visitVerbatimBlockComment(const VerbatimBlockComment *C) {
+void ASTDumper::visitVerbatimBlockComment(const VerbatimBlockComment *C,
+                                          const FullComment *) {
   OS << " Name=\"" << getCommandName(C->getCommandID()) << "\""
         " CloseName=\"" << C->getCloseName() << "\"";
 }
 
-void ASTDumper::visitVerbatimBlockLineComment(
-    const VerbatimBlockLineComment *C) {
+void ASTDumper::visitVerbatimBlockLineComment(const VerbatimBlockLineComment *C,
+                                              const FullComment *) {
   OS << " Text=\"" << C->getText() << "\"";
 }
 
-void ASTDumper::visitVerbatimLineComment(const VerbatimLineComment *C) {
+void ASTDumper::visitVerbatimLineComment(const VerbatimLineComment *C,
+                                         const FullComment *) {
   OS << " Text=\"" << C->getText() << "\"";
 }
 
Index: include/clang/AST/CommentVisitor.h
===================================================================
--- include/clang/AST/CommentVisitor.h
+++ include/clang/AST/CommentVisitor.h
@@ -28,7 +28,7 @@
   return static_cast<ImplClass *>(this)->visit##NAME(                          \
       static_cast<PTR(CLASS)>(C), std::forward<ParamTys>(P)...)
 
-  RetTy visit(PTR(Comment) C, ParamTys&&... P) {
+  RetTy visit(PTR(Comment) C, ParamTys... P) {
     if (!C)
       return RetTy();
 
@@ -47,12 +47,12 @@
   // on Visit* method for the superclass.
 #define ABSTRACT_COMMENT(COMMENT) COMMENT
 #define COMMENT(CLASS, PARENT)                                                 \
-  RetTy visit##CLASS(PTR(CLASS) C, ParamTys&&... P) { DISPATCH(PARENT, PARENT); }
+  RetTy visit##CLASS(PTR(CLASS) C, ParamTys... P) { DISPATCH(PARENT, PARENT); }
 #include "clang/AST/CommentNodes.inc"
 #undef ABSTRACT_COMMENT
 #undef COMMENT
 
-  RetTy visitComment(PTR(Comment) C, ParamTys&&... P) { return RetTy(); }
+  RetTy visitComment(PTR(Comment) C, ParamTys... P) { return RetTy(); }
 
 #undef PTR
 #undef DISPATCH
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to