r347901 - NFC: Fix case of CommentVisitor::Visit methods
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 29 11:42:29 PST 2018
On Thu, Nov 29, 2018 at 2:34 PM Stephen Kelly via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: steveire
> Date: Thu Nov 29 11:31:32 2018
> New Revision: 347901
>
> URL: http://llvm.org/viewvc/llvm-project?rev=347901&view=rev
> Log:
> NFC: Fix case of CommentVisitor::Visit methods
>
> This difference is very visible because it is used with other Visitor
> classes together.
>
> Modified:
> cfe/trunk/include/clang/AST/CommentVisitor.h
> cfe/trunk/lib/AST/ASTDumper.cpp
This breaks the other consumers of this API, like
CommentASTToHTMLConverter in CommentToXML.cpp, as well as users from
clang-tools-extra.
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/15880/steps/build%20stage%201/logs/stdio
Btw, while this is NFC, you really should check with the community
before churning APIs like this. I personally don't have a problem with
it, but I also don't see the benefit to the churn because there's not
a lot of justification in the commit message. (That doesn't mean the
change itself is bad.)
~Aaron
>
> Modified: cfe/trunk/include/clang/AST/CommentVisitor.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentVisitor.h?rev=347901&r1=347900&r2=347901&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/CommentVisitor.h (original)
> +++ cfe/trunk/include/clang/AST/CommentVisitor.h Thu Nov 29 11:31:32 2018
> @@ -23,10 +23,10 @@ template<template <typename> class Ptr,
> class CommentVisitorBase {
> public:
> #define PTR(CLASS) typename Ptr<CLASS>::type
> -#define DISPATCH(NAME, CLASS) \
> - return static_cast<ImplClass*>(this)->visit ## NAME(static_cast<PTR(CLASS)>(C))
> +#define DISPATCH(NAME, CLASS) \
> + return static_cast<ImplClass *>(this)->Visit##NAME(static_cast<PTR(CLASS)>(C))
>
> - RetTy visit(PTR(Comment) C) {
> + RetTy Visit(PTR(Comment) C) {
> if (!C)
> return RetTy();
>
> @@ -44,13 +44,13 @@ public:
> // If the derived class does not implement a certain Visit* method, fall back
> // on Visit* method for the superclass.
> #define ABSTRACT_COMMENT(COMMENT) COMMENT
> -#define COMMENT(CLASS, PARENT) \
> - RetTy visit ## CLASS(PTR(CLASS) C) { DISPATCH(PARENT, PARENT); }
> +#define COMMENT(CLASS, PARENT) \
> + RetTy Visit##CLASS(PTR(CLASS) C) { DISPATCH(PARENT, PARENT); }
> #include "clang/AST/CommentNodes.inc"
> #undef ABSTRACT_COMMENT
> #undef COMMENT
>
> - RetTy visitComment(PTR(Comment) C) { return RetTy(); }
> + RetTy VisitComment(PTR(Comment) C) { return RetTy(); }
>
> #undef PTR
> #undef DISPATCH
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=347901&r1=347900&r2=347901&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Thu Nov 29 11:31:32 2018
> @@ -589,18 +589,18 @@ namespace {
> void dumpComment(const Comment *C);
>
> // 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);
> + void VisitInlineCommandComment(const InlineCommandComment *C);
> + void VisitHTMLStartTagComment(const HTMLStartTagComment *C);
> + void VisitHTMLEndTagComment(const HTMLEndTagComment *C);
>
> // 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);
> + 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);
> };
> }
>
> @@ -2670,18 +2670,18 @@ void ASTDumper::dumpComment(const Commen
> }
> dumpPointer(C);
> dumpSourceRange(C->getSourceRange());
> - ConstCommentVisitor<ASTDumper>::visit(C);
> + ConstCommentVisitor<ASTDumper>::Visit(C);
> for (Comment::child_iterator I = C->child_begin(), E = C->child_end();
> I != E; ++I)
> dumpComment(*I);
> });
> }
>
> -void ASTDumper::visitTextComment(const TextComment *C) {
> +void ASTDumper::VisitTextComment(const TextComment *C) {
> OS << " Text=\"" << C->getText() << "\"";
> }
>
> -void ASTDumper::visitInlineCommandComment(const InlineCommandComment *C) {
> +void ASTDumper::VisitInlineCommandComment(const InlineCommandComment *C) {
> OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
> switch (C->getRenderKind()) {
> case InlineCommandComment::RenderNormal:
> @@ -2702,7 +2702,7 @@ void ASTDumper::visitInlineCommandCommen
> OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
> }
>
> -void ASTDumper::visitHTMLStartTagComment(const HTMLStartTagComment *C) {
> +void ASTDumper::VisitHTMLStartTagComment(const HTMLStartTagComment *C) {
> OS << " Name=\"" << C->getTagName() << "\"";
> if (C->getNumAttrs() != 0) {
> OS << " Attrs: ";
> @@ -2715,17 +2715,17 @@ void ASTDumper::visitHTMLStartTagComment
> OS << " SelfClosing";
> }
>
> -void ASTDumper::visitHTMLEndTagComment(const HTMLEndTagComment *C) {
> +void ASTDumper::VisitHTMLEndTagComment(const HTMLEndTagComment *C) {
> OS << " Name=\"" << C->getTagName() << "\"";
> }
>
> -void ASTDumper::visitBlockCommandComment(const BlockCommandComment *C) {
> +void ASTDumper::VisitBlockCommandComment(const BlockCommandComment *C) {
> 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) {
> OS << " " << ParamCommandComment::getDirectionAsString(C->getDirection());
>
> if (C->isDirectionExplicit())
> @@ -2744,7 +2744,7 @@ void ASTDumper::visitParamCommandComment
> OS << " ParamIndex=" << C->getParamIndex();
> }
>
> -void ASTDumper::visitTParamCommandComment(const TParamCommandComment *C) {
> +void ASTDumper::VisitTParamCommandComment(const TParamCommandComment *C) {
> if (C->hasParamName()) {
> if (C->isPositionValid())
> OS << " Param=\"" << C->getParamName(FC) << "\"";
> @@ -2763,17 +2763,17 @@ void ASTDumper::visitTParamCommandCommen
> }
> }
>
> -void ASTDumper::visitVerbatimBlockComment(const VerbatimBlockComment *C) {
> +void ASTDumper::VisitVerbatimBlockComment(const VerbatimBlockComment *C) {
> OS << " Name=\"" << getCommandName(C->getCommandID()) << "\""
> " CloseName=\"" << C->getCloseName() << "\"";
> }
>
> -void ASTDumper::visitVerbatimBlockLineComment(
> +void ASTDumper::VisitVerbatimBlockLineComment(
> const VerbatimBlockLineComment *C) {
> OS << " Text=\"" << C->getText() << "\"";
> }
>
> -void ASTDumper::visitVerbatimLineComment(const VerbatimLineComment *C) {
> +void ASTDumper::VisitVerbatimLineComment(const VerbatimLineComment *C) {
> OS << " Text=\"" << C->getText() << "\"";
> }
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list