本文整理汇总了C++中Arg类的典型用法代码示例。如果您正苦于以下问题:C++ Arg类的具体用法?C++ Arg怎么用?C++ Arg使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Arg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: T
const char *tools::SplitDebugName(const ArgList &Args, const InputInfo &Input) {
Arg *FinalOutput = Args.getLastArg(options::OPT_o);
if (FinalOutput && Args.hasArg(options::OPT_c)) {
SmallString<128> T(FinalOutput->getValue());
llvm::sys::path::replace_extension(T, "dwo");
return Args.MakeArgString(T);
} else {
// Use the compilation dir.
SmallString<128> T(
Args.getLastArgValue(options::OPT_fdebug_compilation_dir));
SmallString<128> F(llvm::sys::path::stem(Input.getBaseInput()));
llvm::sys::path::replace_extension(F, "dwo");
T += F;
return Args.MakeArgString(F);
}
}
示例2: PrintOptions
void Driver::PrintOptions(const ArgList &Args) const {
unsigned i = 0;
for (ArgList::const_iterator it = Args.begin(), ie = Args.end();
it != ie; ++it, ++i) {
Arg *A = *it;
llvm::errs() << "Option " << i << " - "
<< "Name: \"" << A->getOption().getName() << "\", "
<< "Values: {";
for (unsigned j = 0; j < A->getNumValues(); ++j) {
if (j)
llvm::errs() << ", ";
llvm::errs() << '"' << A->getValue(Args, j) << '"';
}
llvm::errs() << "}\n";
}
}
示例3: Arg
Arg *MultiArgOption::accept(const ArgList &Args, unsigned &Index) const {
// Matches iff this is an exact match.
// FIXME: Avoid strlen.
if (strlen(getName()) != strlen(Args.getArgString(Index)))
return 0;
Index += 1 + NumArgs;
if (Index > Args.getNumInputArgStrings())
return 0;
Arg *A = new Arg(getUnaliasedOption(), Index - 1 - NumArgs,
Args.getArgString(Index - NumArgs));
for (unsigned i = 1; i != NumArgs; ++i)
A->getValues().push_back(Args.getArgString(Index - NumArgs + i));
return A;
}
示例4: TEST
TEST(Arg, isReadOk)//Test avec 3 arguments correct lecture fichier
{
argvRead[1] = "--file";
argvRead[2] = "input.csv";
ReadArgTest.readArg(3,argvRead,&state, &newdata);
EXPECT_EQ(READ, state);
}
示例5:
Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,
OptSpecifier Id2, OptSpecifier Id3,
OptSpecifier Id4) const {
Arg *Res = nullptr;
for (const_iterator it = begin(), ie = end(); it != ie; ++it) {
if ((*it)->getOption().matches(Id0) ||
(*it)->getOption().matches(Id1) ||
(*it)->getOption().matches(Id2) ||
(*it)->getOption().matches(Id3) ||
(*it)->getOption().matches(Id4)) {
Res = *it;
Res->claim();
}
}
return Res;
}
示例6: getAArch64ArchFeaturesFromMarch
void aarch64::getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
std::vector<StringRef> &Features) {
Arg *A;
bool success = true;
// Enable NEON by default.
Features.push_back("+neon");
if ((A = Args.getLastArg(options::OPT_march_EQ)))
success = getAArch64ArchFeaturesFromMarch(D, A->getValue(), Args, Features);
else if ((A = Args.getLastArg(options::OPT_mcpu_EQ)))
success = getAArch64ArchFeaturesFromMcpu(D, A->getValue(), Args, Features);
else if (Args.hasArg(options::OPT_arch))
success = getAArch64ArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args, A),
Args, Features);
if (success && (A = Args.getLastArg(clang::driver::options::OPT_mtune_EQ)))
success =
getAArch64MicroArchFeaturesFromMtune(D, A->getValue(), Args, Features);
else if (success && (A = Args.getLastArg(options::OPT_mcpu_EQ)))
success =
getAArch64MicroArchFeaturesFromMcpu(D, A->getValue(), Args, Features);
else if (success && Args.hasArg(options::OPT_arch))
success = getAArch64MicroArchFeaturesFromMcpu(
D, getAArch64TargetCPU(Args, A), Args, Features);
if (!success)
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
if (Args.getLastArg(options::OPT_mgeneral_regs_only)) {
Features.push_back("-fp-armv8");
Features.push_back("-crypto");
Features.push_back("-neon");
}
// En/disable crc
if (Arg *A = Args.getLastArg(options::OPT_mcrc, options::OPT_mnocrc)) {
if (A->getOption().matches(options::OPT_mcrc))
Features.push_back("+crc");
else
Features.push_back("-crc");
}
if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access))
if (A->getOption().matches(options::OPT_mno_unaligned_access))
Features.push_back("+strict-align");
if (Args.hasArg(options::OPT_ffixed_x18))
Features.push_back("+reserve-x18");
if (Args.hasArg(options::OPT_ffixed_x20))
Features.push_back("+reserve-x20");
if (Args.hasArg(options::OPT_mno_neg_immediates))
Features.push_back("+no-neg-immediates");
}
示例7: dispatch_createcomposite
/** Send a create composite task to a target worker
* @param wi a worker information that will execute this CreateComposite task
* @param name a name of Composite array that will be created
* @param name arg argument that contains information about splits that will build a composite array
* @param id an ID of this task (Generally 0)
* @param uid a real ID of this task
* @return NULL
*/
static void dispatch_createcomposite(WorkerInfo *wi,
const string &name,
const Arg &carg,
const std::vector<Arg>* task_args,
::uint64_t id,
::uint64_t uid,
::uint64_t parentid) {
CreateCompositeRequest req;
req.set_name(name);
for (int j = 0; j < carg.arrays_size(); j++) {
NewArg arg;
arg.set_varname(carg.name());
arg.set_arrayname(carg.arrays(j).name());
req.add_cargs()->CopyFrom(arg);
//req.add_arraynames(carg.arrays(j).name());
req.add_offsets()->CopyFrom(carg.offsets(j));
}
req.mutable_dims()->CopyFrom(carg.dim());
if(task_args !=NULL && DATASTORE == RINSTANCE) {
for (int i = 0; i < task_args->size(); i++) {
if ((*task_args)[i].arrays_size() == 1 || (*task_args)[i].is_list()) {
NewArg arg;
arg.set_varname((*task_args)[i].name());
if((*task_args)[i].is_list()){
for(int j = 0; j < (*task_args)[i].arrays_size(); j ++){
arg.add_list_arraynames((*task_args)[i].arrays(j).name());
}
arg.set_arrayname("list_type...");
}else{
arg.set_arrayname((*task_args)[i].arrays(0).name());
}
req.add_task_args()->CopyFrom(arg);
}
}
}
req.set_id(id);
req.set_uid(uid);
req.set_parenttaskid(parentid);
wi->CreateComposite(req);
LOG_INFO("CREATECOMPOSITE Create TaskID %6d - Sent to Worker %s", static_cast<int>(uid), wi->hostname().c_str());
}
示例8: mustEmitDebugInfo
static DebugInfoKind mustEmitDebugInfo(const ArgList &Args) {
Arg *A = Args.getLastArg(options::OPT_O_Group);
if (Args.hasFlag(options::OPT_cuda_noopt_device_debug,
options::OPT_no_cuda_noopt_device_debug,
!A || A->getOption().matches(options::OPT_O0))) {
if (const Arg *A = Args.getLastArg(options::OPT_g_Group)) {
const Option &Opt = A->getOption();
if (Opt.matches(options::OPT_gN_Group)) {
if (Opt.matches(options::OPT_g0) || Opt.matches(options::OPT_ggdb0))
return NoDebug;
if (Opt.matches(options::OPT_gline_tables_only) ||
Opt.matches(options::OPT_ggdb1))
return LineTableOnly;
}
return FullDebug;
}
}
return NoDebug;
}
示例9: GetFilePath
bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList &Args,
ArgStringList &CmdArgs) const {
// Check if -ffast-math or -funsafe-math is enabled.
Arg *A = Args.getLastArg(options::OPT_ffast_math,
options::OPT_fno_fast_math,
options::OPT_funsafe_math_optimizations,
options::OPT_fno_unsafe_math_optimizations);
if (!A || A->getOption().getID() == options::OPT_fno_fast_math ||
A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations)
return false;
// If crtfastmath.o exists add it to the arguments.
std::string Path = GetFilePath("crtfastmath.o");
if (Path == "crtfastmath.o") // Not found.
return false;
CmdArgs.push_back(Args.MakeArgString(Path));
return true;
}
示例10: run
virtual void
run (Arg arg)
{
string pipeID = isnil (arg)? "Black Hole" : arg[1];
string streamID = 2>arg.size()? "teststream" : arg[2] ;
createExplicit (pipeID,streamID);
create_or_ref (pipeID);
create_using_default ();
dependProcPatt (pipeID);
}
示例11: CrashInfo
InputArgList *Driver::ParseArgStrings(const char **ArgBegin,
const char **ArgEnd) {
llvm::PrettyStackTraceString CrashInfo("Command line argument parsing");
InputArgList *Args = new InputArgList(ArgBegin, ArgEnd);
// FIXME: Handle '@' args (or at least error on them).
unsigned Index = 0, End = ArgEnd - ArgBegin;
while (Index < End) {
// gcc's handling of empty arguments doesn't make
// sense, but this is not a common use case. :)
//
// We just ignore them here (note that other things may
// still take them as arguments).
if (Args->getArgString(Index)[0] == '\0') {
++Index;
continue;
}
unsigned Prev = Index;
Arg *A = getOpts().ParseOneArg(*Args, Index);
assert(Index > Prev && "Parser failed to consume argument.");
// Check for missing argument error.
if (!A) {
assert(Index >= End && "Unexpected parser error.");
Diag(clang::diag::err_drv_missing_argument)
<< Args->getArgString(Prev)
<< (Index - Prev - 1);
break;
}
if (A->getOption().isUnsupported()) {
Diag(clang::diag::err_drv_unsupported_opt) << A->getAsString(*Args);
continue;
}
Args->append(A);
}
return Args;
}
示例12: GetFilePath
bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList &Args,
ArgStringList &CmdArgs) const {
// Do not check for -fno-fast-math or -fno-unsafe-math when -Ofast passed
// (to keep the linker options consistent with gcc and clang itself).
if (!isOptimizationLevelFast(Args)) {
// Check if -ffast-math or -funsafe-math.
Arg *A =
Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math,
options::OPT_funsafe_math_optimizations,
options::OPT_fno_unsafe_math_optimizations);
if (!A || A->getOption().getID() == options::OPT_fno_fast_math ||
A->getOption().getID() == options::OPT_fno_unsafe_math_optimizations)
return false;
}
// If crtfastmath.o exists add it to the arguments.
std::string Path = GetFilePath("crtfastmath.o");
if (Path == "crtfastmath.o") // Not found.
return false;
CmdArgs.push_back(Args.MakeArgString(Path));
return true;
}
示例13: run
virtual void
run (Arg arg)
{
if (0 < arg.size()) NUM_ELMS = lexical_cast<uint> (arg[1]);
verify_simpleIters();
verify_transformIter();
verify_MapWrappers<TreeMap>();
verify_MapWrappers<HashMap>();
verify_MultimapIters<TreeMultimap>();
verify_MultimapIters<HashMultimap>();
}
示例14: isValid
bool PatchpointSpecial::isValid(Inst& inst)
{
PatchpointValue* patchpoint = inst.origin->as<PatchpointValue>();
unsigned argIndex = 1;
if (inst.origin->type() != Void) {
if (argIndex >= inst.args.size())
return false;
if (!isArgValidForValue(inst.args[argIndex], patchpoint))
return false;
if (!isArgValidForRep(code(), inst.args[argIndex], patchpoint->resultConstraint))
return false;
argIndex++;
}
if (!isValidImpl(0, argIndex, inst))
return false;
argIndex += patchpoint->numChildren();
if (argIndex + patchpoint->numGPScratchRegisters + patchpoint->numFPScratchRegisters
!= inst.args.size())
return false;
for (unsigned i = patchpoint->numGPScratchRegisters; i--;) {
Arg arg = inst.args[argIndex++];
if (!arg.isGPTmp())
return false;
}
for (unsigned i = patchpoint->numFPScratchRegisters; i--;) {
Arg arg = inst.args[argIndex++];
if (!arg.isFPTmp())
return false;
}
return true;
}
示例15: CrashInfo
InputArgList *Driver::ParseArgStrings(const char **ArgBegin,
const char **ArgEnd) {
llvm::PrettyStackTraceString CrashInfo("Command line argument parsing");
unsigned MissingArgIndex, MissingArgCount;
InputArgList *Args = getOpts().ParseArgs(ArgBegin, ArgEnd,
MissingArgIndex, MissingArgCount);
// Check for missing argument error.
if (MissingArgCount)
Diag(clang::diag::err_drv_missing_argument)
<< Args->getArgString(MissingArgIndex) << MissingArgCount;
// Check for unsupported options.
for (ArgList::const_iterator it = Args->begin(), ie = Args->end();
it != ie; ++it) {
Arg *A = *it;
if (A->getOption().isUnsupported()) {
Diag(clang::diag::err_drv_unsupported_opt) << A->getAsString(*Args);
continue;
}
}
return Args;
}