================
@@ -115,13 +115,16 @@ class StmtVisitorBase {
// If the implementation chooses not to implement a certain visit method,
fall
// back on VisitExpr or whatever else is the superclass.
+ // clang-format off
----------------
dzbarsky wrote:
I didn't like what it did to the macro invocations :)
```
diff --git a/clang/include/clang/AST/StmtVisitor.h
b/clang/include/clang/AST/StmtVisitor.h
index 2e4ca87c0a78..de6eae4c5f57 100644
--- a/clang/include/clang/AST/StmtVisitor.h
+++ b/clang/include/clang/AST/StmtVisitor.h
@@ -115,67 +115,74 @@ public:
// If the implementation chooses not to implement a certain visit method,
fall
// back on VisitExpr or whatever else is the superclass.
-#define STMT(CLASS, PARENT) \
- LLVM_ATTRIBUTE_ALWAYS_INLINE \
- RetTy Visit ## CLASS(PTR(CLASS) S, ParamTys... P) { DISPATCH(PARENT,
PARENT); }
+#define STMT(CLASS, PARENT)
\
+ LLVM_ATTRIBUTE_ALWAYS_INLINE
\
+ RetTy Visit##CLASS(PTR(CLASS) S, ParamTys... P) { DISPATCH(PARENT, PARENT); }
#include "clang/AST/StmtNodes.inc"
// If the implementation doesn't implement binary operator methods, fall back
// on VisitBinaryOperator.
-#define BINOP_FALLBACK(NAME) \
- LLVM_ATTRIBUTE_ALWAYS_INLINE \
- RetTy VisitBin ## NAME(PTR(BinaryOperator) S, ParamTys... P) { \
- DISPATCH(BinaryOperator, BinaryOperator); \
+#define BINOP_FALLBACK(NAME)
\
+ LLVM_ATTRIBUTE_ALWAYS_INLINE
\
+ RetTy VisitBin##NAME(PTR(BinaryOperator) S, ParamTys... P) {
\
+ DISPATCH(BinaryOperator, BinaryOperator);
\
}
- BINOP_FALLBACK(PtrMemD) BINOP_FALLBACK(PtrMemI)
- BINOP_FALLBACK(Mul) BINOP_FALLBACK(Div) BINOP_FALLBACK(Rem)
- BINOP_FALLBACK(Add) BINOP_FALLBACK(Sub) BINOP_FALLBACK(Shl)
- BINOP_FALLBACK(Shr)
+ BINOP_FALLBACK(PtrMemD)
+ BINOP_FALLBACK(PtrMemI) BINOP_FALLBACK(Mul) BINOP_FALLBACK(
+ Div) BINOP_FALLBACK(Rem) BINOP_FALLBACK(Add) BINOP_FALLBACK(Sub)
+ BINOP_FALLBACK(Shl) BINOP_FALLBACK(Shr)
- BINOP_FALLBACK(LT) BINOP_FALLBACK(GT) BINOP_FALLBACK(LE)
- BINOP_FALLBACK(GE) BINOP_FALLBACK(EQ) BINOP_FALLBACK(NE)
- BINOP_FALLBACK(Cmp)
+ BINOP_FALLBACK(LT) BINOP_FALLBACK(GT) BINOP_FALLBACK(LE)
BINOP_FALLBACK(
+ GE) BINOP_FALLBACK(EQ) BINOP_FALLBACK(NE) BINOP_FALLBACK(Cmp)
- BINOP_FALLBACK(And) BINOP_FALLBACK(Xor) BINOP_FALLBACK(Or)
- BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr)
+ BINOP_FALLBACK(And) BINOP_FALLBACK(Xor) BINOP_FALLBACK(
+ Or) BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr)
- BINOP_FALLBACK(Assign)
- BINOP_FALLBACK(Comma)
+ BINOP_FALLBACK(Assign) BINOP_FALLBACK(Comma)
#undef BINOP_FALLBACK
// If the implementation doesn't implement compound assignment operator
// methods, fall back on VisitCompoundAssignOperator.
-#define CAO_FALLBACK(NAME) \
- LLVM_ATTRIBUTE_ALWAYS_INLINE \
- RetTy VisitBin ## NAME(PTR(CompoundAssignOperator) S, ParamTys... P) { \
- DISPATCH(CompoundAssignOperator, CompoundAssignOperator); \
+#define CAO_FALLBACK(NAME)
\
+ LLVM_ATTRIBUTE_ALWAYS_INLINE
\
+ RetTy VisitBin##NAME(PTR(CompoundAssignOperator) S, ParamTys... P) {
\
+ DISPATCH(CompoundAssignOperator, CompoundAssignOperator);
\
}
- CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign) CAO_FALLBACK(RemAssign)
- CAO_FALLBACK(AddAssign) CAO_FALLBACK(SubAssign) CAO_FALLBACK(ShlAssign)
- CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign)
- CAO_FALLBACK(XorAssign)
+ CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign)
CAO_FALLBACK(
+ RemAssign) CAO_FALLBACK(AddAssign)
+ CAO_FALLBACK(SubAssign) CAO_FALLBACK(
+ ShlAssign) CAO_FALLBACK(ShrAssign)
+ CAO_FALLBACK(AndAssign) CAO_FALLBACK(
+ OrAssign) CAO_FALLBACK(XorAssign)
#undef CAO_FALLBACK
// If the implementation doesn't implement unary operator methods, fall back
// on VisitUnaryOperator.
-#define UNARYOP_FALLBACK(NAME) \
- LLVM_ATTRIBUTE_ALWAYS_INLINE \
- RetTy VisitUnary ## NAME(PTR(UnaryOperator) S, ParamTys... P) { \
- DISPATCH(UnaryOperator, UnaryOperator); \
+#define UNARYOP_FALLBACK(NAME)
\
+ LLVM_ATTRIBUTE_ALWAYS_INLINE
\
+ RetTy VisitUnary##NAME(PTR(UnaryOperator) S, ParamTys... P) {
\
+ DISPATCH(UnaryOperator, UnaryOperator);
\
}
- UNARYOP_FALLBACK(PostInc) UNARYOP_FALLBACK(PostDec)
- UNARYOP_FALLBACK(PreInc) UNARYOP_FALLBACK(PreDec)
- UNARYOP_FALLBACK(AddrOf) UNARYOP_FALLBACK(Deref)
-
- UNARYOP_FALLBACK(Plus) UNARYOP_FALLBACK(Minus)
- UNARYOP_FALLBACK(Not) UNARYOP_FALLBACK(LNot)
- UNARYOP_FALLBACK(Real) UNARYOP_FALLBACK(Imag)
- UNARYOP_FALLBACK(Extension) UNARYOP_FALLBACK(Coawait)
+ UNARYOP_FALLBACK(PostInc) UNARYOP_FALLBACK(
+ PostDec) UNARYOP_FALLBACK(PreInc)
+ UNARYOP_FALLBACK(PreDec)
UNARYOP_FALLBACK(
+ AddrOf) UNARYOP_FALLBACK(Deref)
+
+ UNARYOP_FALLBACK(
+ Plus) UNARYOP_FALLBACK(Minus)
+ UNARYOP_FALLBACK(
+ Not) UNARYOP_FALLBACK(LNot)
+ UNARYOP_FALLBACK(Real)
+ UNARYOP_FALLBACK(Imag)
+ UNARYOP_FALLBACK(
+ Extension)
+ UNARYOP_FALLBACK(
+ Coawait)
#undef UNARYOP_FALLBACK
- // Base case, ignore it. :)
- LLVM_ATTRIBUTE_ALWAYS_INLINE RetTy VisitStmt(PTR(Stmt) Node,
- ParamTys... P) {
+ // Base case, ignore it. :)
+ LLVM_ATTRIBUTE_ALWAYS_INLINE RetTy
+ VisitStmt(PTR(Stmt) Node, ParamTys... P) {
return RetTy();
}
```
https://github.com/llvm/llvm-project/pull/203125
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits