当前位置: 首页>>代码示例>>C++>>正文


C++ InputArgList::append方法代码示例

本文整理汇总了C++中InputArgList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ InputArgList::append方法的具体用法?C++ InputArgList::append怎么用?C++ InputArgList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputArgList的用法示例。


在下文中一共展示了InputArgList::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: InputArgList

InputArgList *OptTable::ParseArgs(const char* const *ArgBegin,
                                  const char* const *ArgEnd,
                                  unsigned &MissingArgIndex,
                                  unsigned &MissingArgCount) const {
  InputArgList *Args = new InputArgList(ArgBegin, ArgEnd);

  // FIXME: Handle '@' args (or at least error on them).

  MissingArgIndex = MissingArgCount = 0;
  unsigned Index = 0, End = ArgEnd - ArgBegin;
  while (Index < End) {
    // Ignore empty arguments (other things may still take them as arguments).
    if (Args->getArgString(Index)[0] == '\0') {
      ++Index;
      continue;
    }

    unsigned Prev = Index;
    Arg *A = ParseOneArg(*Args, Index);
    assert(Index > Prev && "Parser failed to consume argument.");

    // Check for missing argument error.
    if (!A) {
      assert(Index >= End && "Unexpected parser error.");
      assert(Index - Prev - 1 && "No missing arguments!");
      MissingArgIndex = Prev;
      MissingArgCount = Index - Prev - 1;
      break;
    }

    Args->append(A);
  }

  return Args;
}
开发者ID:32bitmicro,项目名称:llvm,代码行数:35,代码来源:OptTable.cpp

示例2: 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;
}
开发者ID:Killfrra,项目名称:llvm-kernel,代码行数:41,代码来源:Driver.cpp


注:本文中的InputArgList::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。