Skip to content

Commit

Permalink
Use C++11 raw string literal to embed intrinsics file. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed Jan 6, 2024
1 parent 82057de commit 04a789f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 1 addition & 8 deletions src/passes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
file(READ wasm-intrinsics.wat WASM_INTRINSICS_WAT HEX)
set(CMAKE_CONFIGURE_DEPENDS wasm-intrinsics.wat)

string(REGEX MATCHALL "([A-Fa-f0-9][A-Fa-f0-9])" SEPARATED_HEX ${WASM_INTRINSICS_WAT})

foreach (hex IN LISTS SEPARATED_HEX)
string(APPEND WASM_INTRINSICS_EMBED "0x${hex},")
endforeach ()
string(APPEND WASM_INTRINSICS_EMBED "0x00")

file(READ wasm-intrinsics.wat WASM_INTRINSICS_WAT)
configure_file(WasmIntrinsics.cpp.in WasmIntrinsics.cpp @ONLY)

FILE(GLOB passes_HEADERS *.h)
Expand Down
8 changes: 3 additions & 5 deletions src/passes/WasmIntrinsics.cpp.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#include "passes/intrinsics-module.h"

static const char theModule[] = {
@WASM_INTRINSICS_EMBED@
};

namespace wasm {
const char* IntrinsicsModuleWast = theModule;
const char* IntrinsicsModuleWast = R"""(
@WASM_INTRINSICS_WAT@
)""";
}

0 comments on commit 04a789f

Please sign in to comment.