Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
2c149243
Commit
2c149243
authored
Nov 10, 2019
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the function counter
parent
2c9e8b0e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
CMakeLists.txt
src/CMakeLists.txt
+8
-0
funccnt.cpp
src/funccnt.cpp
+39
-0
No files found.
src/CMakeLists.txt
View file @
2c149243
...
@@ -23,3 +23,11 @@ add_executable(pisn
...
@@ -23,3 +23,11 @@ add_executable(pisn
target_link_libraries
(
pisn
target_link_libraries
(
pisn
kyut
kyut
)
)
add_executable
(
funccnt
funccnt.cpp
)
target_link_libraries
(
funccnt
kyut
)
src/funccnt.cpp
0 → 100644
View file @
2c149243
#include <algorithm>
#include <fmt/printf.h>
#include <wasm-io.h>
int
main
(
int
argc
,
char
*
argv
[])
{
// Parse command line options
if
(
argc
!=
2
)
{
fmt
::
print
(
std
::
cerr
,
"{} <input file>
\n
"
,
argv
[
0
]);
return
1
;
}
const
std
::
string
inputFile
=
argv
[
1
];
try
{
// Read the input module
wasm
::
Module
module
;
wasm
::
ModuleReader
{}.
read
(
inputFile
,
module
);
const
auto
count
=
std
::
count_if
(
std
::
begin
(
module
.
functions
),
std
::
end
(
module
.
functions
),
[](
const
auto
&
f
)
{
return
f
->
body
!=
nullptr
;
});
fmt
::
print
(
"{}
\n
"
,
count
);
}
catch
(
const
wasm
::
ParseException
&
e
)
{
e
.
dump
(
std
::
cerr
);
return
1
;
}
catch
(
const
std
::
exception
&
e
)
{
fmt
::
print
(
std
::
cerr
,
"exception: {}
\n
"
,
e
.
what
());
return
1
;
}
catch
(...)
{
fmt
::
print
(
std
::
cerr
,
"unknown exception
\n
"
);
return
1
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment