forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encode command line to UTF8 on Windows (WebAssembly#5671)
This PR changes how file paths and the command line are handled. On startup on Windows, we process the wstring version of the command line (including the file paths) and re-encode it to UTF8 before handing it off to the rest of the command line handling logic. This means that all paths are stored in UTF8-encoded std::strings as they go through the program, right up until they are used to open files. At that time, they are converted to the appropriate native format with the new to_path function before passing to the stdlib open functions. This has the advantage that all of the non-file-opening code can use a single type to hold paths (which is good since std::filesystem::path has proved problematic in some cases), but has the disadvantage that someone could add new code that forgets to convert to_path before opening. That's somewhat mitigated by the fact that most of the code uses the ModuleIOBase classes for opening files. Fixes WebAssembly#4995
- Loading branch information
1 parent
874b5fe
commit b5f525e
Showing
7 changed files
with
119 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
;; RUN: wasm-as %s -o %t-❤.wasm --source-map %t-🗺️.map | ||
;; RUN: cat %t-🗺️.map | filecheck %s --check-prefix SOURCEMAP | ||
;; RUN: wasm-opt %t-❤.wasm -o %t-🤬.wasm --emit-js-wrapper %t-❤.js --input-source-map %t-🗺️.map --output-source-map %t-🗺️.out.map | ||
;; RUN: cat %t-🗺️.out.map | filecheck %s --check-prefix SOURCEMAP | ||
;; RUN: wasm-dis %t-🤬.wasm | filecheck %s --check-prefix MODULE | ||
|
||
;; MODULE: i32.add | ||
;; SOURCEMAP: src.cpp | ||
|
||
(module | ||
(type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) | ||
(memory $0 256 256) | ||
(export "add" (func $add)) | ||
(func $add (; 0 ;) (param $0 i32) (param $1 i32) (result i32) | ||
(i32.add | ||
;;@ src.cpp:10:1 | ||
(local.get $0) | ||
(local.get $1) | ||
) | ||
) | ||
) |