This source file includes following definitions.
- opt_level_
- set_opt_level
- GetOptCommandline
#include "ppapi/native_client/src/trusted/plugin/pnacl_options.h"
#include <iterator>
#include <vector>
#include "native_client/src/include/nacl_string.h"
namespace plugin {
PnaclOptions::PnaclOptions()
: translate_(false),
is_debug_(false),
opt_level_(2) {
}
PnaclOptions::~PnaclOptions() {
}
void PnaclOptions::set_opt_level(int32_t l) {
if (l <= 0) {
opt_level_ = 0;
return;
}
opt_level_ = 2;
}
std::vector<char> PnaclOptions::GetOptCommandline() const {
std::vector<char> result;
nacl::string str;
nacl::stringstream ss;
ss << "-O" << opt_level_;
str = ss.str();
std::copy(str.begin(), str.end(), std::back_inserter(result));
result.push_back('\x00');
if (is_debug_) {
str = "-bitcode-format=llvm";
std::copy(str.begin(), str.end(), std::back_inserter(result));
result.push_back('\x00');
}
return result;
}
}