summaryrefslogtreecommitdiff
path: root/src/support/file.cpp
diff options
context:
space:
mode:
authorJF Bastien <jfb@chromium.org>2016-01-11 17:23:27 -0800
committerJF Bastien <jfb@chromium.org>2016-01-11 17:23:27 -0800
commit1b3600b0aca6a8f23b6d9e8ae33dcd75c9493810 (patch)
tree606226cd0b851f09999647643476c492a80a93a3 /src/support/file.cpp
parent75a562190a9f4588c8ffb19b8304f76c15a850c6 (diff)
downloadbinaryen-1b3600b0aca6a8f23b6d9e8ae33dcd75c9493810.tar.gz
binaryen-1b3600b0aca6a8f23b6d9e8ae33dcd75c9493810.tar.bz2
binaryen-1b3600b0aca6a8f23b6d9e8ae33dcd75c9493810.zip
asm2wasm: use support's command-line
Diffstat (limited to 'src/support/file.cpp')
-rw-r--r--src/support/file.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/support/file.cpp b/src/support/file.cpp
index 470d07737..8813750d4 100644
--- a/src/support/file.cpp
+++ b/src/support/file.cpp
@@ -18,7 +18,8 @@
#include <cstdlib>
-std::string wasm::read_file(const std::string &filename, bool debug) {
+template <typename T>
+T wasm::read_file(const std::string &filename, bool debug) {
if (debug) std::cerr << "Loading '" << filename << "'..." << std::endl;
std::ifstream infile(filename);
if (!infile.is_open()) {
@@ -27,12 +28,16 @@ std::string wasm::read_file(const std::string &filename, bool debug) {
}
infile.seekg(0, std::ios::end);
size_t insize = infile.tellg();
- std::string input(insize + 1, '\0');
+ T input(insize + 1, '\0');
infile.seekg(0);
infile.read(&input[0], insize);
return input;
}
+// Explicit instantiations for the explicit specializations.
+template std::string wasm::read_file<>(const std::string &, bool);
+template std::vector<char> wasm::read_file<>(const std::string &, bool);
+
wasm::Output::Output(const std::string &filename, bool debug)
: outfile(), out([this, filename, debug]() {
std::streambuf *buffer;