Skip to content

Commit 97e277c

Browse files
authored
Rename wasm-delegations[-fields].h to def files (NFC) (#3941)
These files are special in that they use define symbols that are not defined within those files or other files included in those files; they are supposed to be defined in source files that include these headers. This has caused clang-tidy to fail every time these files have changed because they are not compilable per se. This PR solves the problem by changing their extension to `def`, which is also used in LLVM codebase. LLVM has dozens of files like this whose extension is `def`, which makes these not checked by clang-tidy.
1 parent e158698 commit 97e277c

13 files changed

+20
-20
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ if(NOT (BUILD_STATIC_LIB AND BYN_INSTALL_TOOLS_ONLY))
334334
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
335335
endif()
336336
if(NOT BYN_INSTALL_TOOLS_ONLY)
337-
install(FILES src/binaryen-c.h src/wasm-delegations.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
337+
install(FILES src/binaryen-c.h src/wasm-delegations.def DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
338338
endif()
339339

340340
function(binaryen_add_executable name sources)

src/binaryen-c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ BinaryenExpressionId BinaryenInvalidId(void) {
185185
return Expression::Id::CLASS_TO_VISIT##Id; \
186186
}
187187

188-
#include "wasm-delegations.h"
188+
#include "wasm-delegations.def"
189189

190190
// External kinds
191191

src/binaryen-c.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ BINARYEN_API BinaryenExpressionId BinaryenInvalidId(void);
130130
#define DELEGATE(CLASS_TO_VISIT) \
131131
BINARYEN_API BinaryenExpressionId Binaryen##CLASS_TO_VISIT##Id(void);
132132

133-
#include "wasm-delegations.h"
133+
#include "wasm-delegations.def"
134134

135135
// External kinds (call to get the value of each; you can cache them)
136136

src/ir/ExpressionAnalyzer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ bool ExpressionAnalyzer::flexibleEqual(Expression* left,
230230
} \
231231
}
232232

233-
#include "wasm-delegations-fields.h"
233+
#include "wasm-delegations-fields.def"
234234

235235
return true;
236236
}
@@ -322,7 +322,7 @@ size_t ExpressionAnalyzer::hash(Expression* curr) {
322322

323323
#define DELEGATE_FIELD_SCOPE_NAME_USE(id, name) visitScopeName(cast->name);
324324

325-
#include "wasm-delegations-fields.h"
325+
#include "wasm-delegations-fields.def"
326326
}
327327

328328
void noteScopeName(Name curr) {

src/ir/ExpressionManipulator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ flexibleCopy(Expression* original, Module& wasm, CustomCopier custom) {
101101

102102
#define DELEGATE_FIELD_INT_ARRAY(id, name) COPY_ARRAY(name)
103103

104-
#include "wasm-delegations-fields.h"
104+
#include "wasm-delegations-fields.def"
105105

106106
// The type can be simply copied.
107107
copy->type = original->type;

src/ir/branch-utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ template<typename T> void operateOnScopeNameUses(Expression* expr, T func) {
6666
#define DELEGATE_FIELD_CHILD_VECTOR(id, name)
6767
#define DELEGATE_FIELD_INT_ARRAY(id, name)
6868

69-
#include "wasm-delegations-fields.h"
69+
#include "wasm-delegations-fields.def"
7070
}
7171

7272
// Similar to operateOnScopeNameUses, but also passes in the type that is sent
@@ -131,7 +131,7 @@ template<typename T> void operateOnScopeNameDefs(Expression* expr, T func) {
131131
#define DELEGATE_FIELD_SCOPE_NAME_USE(id, name)
132132
#define DELEGATE_FIELD_SCOPE_NAME_USE_VECTOR(id, name)
133133

134-
#include "wasm-delegations-fields.h"
134+
#include "wasm-delegations-fields.def"
135135
}
136136

137137
using NameSet = std::set<Name>;

src/ir/iteration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ template<class Specific> class AbstractChildIterator {
101101
#define DELEGATE_FIELD_TYPE(id, name)
102102
#define DELEGATE_FIELD_ADDRESS(id, name)
103103

104-
#include "wasm-delegations-fields.h"
104+
#include "wasm-delegations-fields.def"
105105
}
106106

107107
Iterator begin() const { return Iterator(*this, 0); }

src/ir/utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct ReFinalize
113113
#define DELEGATE(CLASS_TO_VISIT) \
114114
void visit##CLASS_TO_VISIT(CLASS_TO_VISIT* curr);
115115

116-
#include "wasm-delegations.h"
116+
#include "wasm-delegations.def"
117117

118118
void visitFunction(Function* curr);
119119

@@ -139,7 +139,7 @@ struct ReFinalizeNode : public OverriddenVisitor<ReFinalizeNode> {
139139
#define DELEGATE(CLASS_TO_VISIT) \
140140
void visit##CLASS_TO_VISIT(CLASS_TO_VISIT* curr) { curr->finalize(); }
141141

142-
#include "wasm-delegations.h"
142+
#include "wasm-delegations.def"
143143

144144
void visitExport(Export* curr) { WASM_UNREACHABLE("unimp"); }
145145
void visitGlobal(Global* curr) { WASM_UNREACHABLE("unimp"); }
File renamed without changes.
File renamed without changes.

src/wasm-stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class BinaryInstWriter : public OverriddenVisitor<BinaryInstWriter> {
105105
#define DELEGATE(CLASS_TO_VISIT) \
106106
void visit##CLASS_TO_VISIT(CLASS_TO_VISIT* curr);
107107

108-
#include "wasm-delegations.h"
108+
#include "wasm-delegations.def"
109109

110110
void emitResultType(Type type);
111111
void emitIfElse(If* curr);

src/wasm-traversal.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ template<typename SubType, typename ReturnType = void> struct Visitor {
4141
ReturnType visit##CLASS_TO_VISIT(CLASS_TO_VISIT* curr) { \
4242
return ReturnType(); \
4343
}
44-
#include "wasm-delegations.h"
44+
#include "wasm-delegations.def"
4545

4646
// Module-level visitors
4747
ReturnType visitExport(Export* curr) { return ReturnType(); }
@@ -62,7 +62,7 @@ template<typename SubType, typename ReturnType = void> struct Visitor {
6262
return static_cast<SubType*>(this)->visit##CLASS_TO_VISIT( \
6363
static_cast<CLASS_TO_VISIT*>(curr))
6464

65-
#include "wasm-delegations.h"
65+
#include "wasm-delegations.def"
6666

6767
default:
6868
WASM_UNREACHABLE("unexpected expression type");
@@ -84,7 +84,7 @@ struct OverriddenVisitor {
8484
WASM_UNREACHABLE("Derived class must implement visit" #CLASS_TO_VISIT); \
8585
}
8686

87-
#include "wasm-delegations.h"
87+
#include "wasm-delegations.def"
8888

8989
ReturnType visit(Expression* curr) {
9090
assert(curr);
@@ -95,7 +95,7 @@ struct OverriddenVisitor {
9595
return static_cast<SubType*>(this)->visit##CLASS_TO_VISIT( \
9696
static_cast<CLASS_TO_VISIT*>(curr))
9797

98-
#include "wasm-delegations.h"
98+
#include "wasm-delegations.def"
9999

100100
default:
101101
WASM_UNREACHABLE("unexpected expression type");
@@ -117,7 +117,7 @@ struct UnifiedExpressionVisitor : public Visitor<SubType, ReturnType> {
117117
return static_cast<SubType*>(this)->visitExpression(curr); \
118118
}
119119

120-
#include "wasm-delegations.h"
120+
#include "wasm-delegations.def"
121121
};
122122

123123
//
@@ -327,7 +327,7 @@ struct Walker : public VisitorType {
327327
self->visit##CLASS_TO_VISIT((*currp)->cast<CLASS_TO_VISIT>()); \
328328
}
329329

330-
#include "wasm-delegations.h"
330+
#include "wasm-delegations.def"
331331

332332
void setModule(Module* module) { currModule = module; }
333333

@@ -377,7 +377,7 @@ struct PostWalker : public Walker<SubType, VisitorType> {
377377
#define DELEGATE_FIELD_TYPE(id, name)
378378
#define DELEGATE_FIELD_ADDRESS(id, name)
379379

380-
#include "wasm-delegations-fields.h"
380+
#include "wasm-delegations-fields.def"
381381
}
382382
};
383383

src/wasm/wasm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const char* getExpressionName(Expression* curr) {
110110
case Expression::Id::CLASS_TO_VISIT##Id: \
111111
return #CLASS_TO_VISIT;
112112

113-
#include "wasm-delegations.h"
113+
#include "wasm-delegations.def"
114114

115115
default:
116116
WASM_UNREACHABLE("invalid id");

0 commit comments

Comments
 (0)