Commit 048c6eaf authored by nagayama15's avatar nagayama15

コマンドラインオプションのサンプルを追加

parent 97558d89
......@@ -3,6 +3,8 @@
#include <llvm/Pass.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/Support/CommandLine.h>
namespace
{
/**
......@@ -82,7 +84,8 @@ namespace
char BlockCounterPass::ID;
// Register pass.
llvm::RegisterPass<BlockCounterPass> pass_registry {
const llvm::RegisterPass<BlockCounterPass> pass_registry =
{
"count-block",
"IR analyzer",
};
......
......@@ -5,6 +5,14 @@
namespace
{
const llvm::cl::opt<int> test_opt
{
"test_opt",
llvm::cl::desc("Test pass option"),
llvm::cl::value_desc("test"),
llvm::cl::init(10),
};
/**
* @brief First watermarker pass.
*/
......@@ -41,6 +49,7 @@ namespace
bool doInitialization(llvm::Module& module) override
{
llvm::errs() << __FUNCTION__ << " : " << module.getName() << "\n";
llvm::errs() << "test_opt: " << test_opt << "\n";
return false;
}
......@@ -90,7 +99,8 @@ namespace
char TestPass::ID;
// Register pass.
llvm::RegisterPass<TestPass> test_pass_registry {
const llvm::RegisterPass<TestPass> pass_registry =
{
"testpass",
"Test pass",
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment