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


C++ SMDiagnostic::getColumnNo方法代码示例

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


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

示例1: PROTECT

void
raiseError(llvm::SMDiagnostic err)
{
    SEXP e, cur;
    PROTECT(e = allocVector(LANGSXP, 4));
    SETCAR(e, Rf_install("parseIRError")); cur = CDR(e);
    SETCAR(cur, ScalarInteger(err.getLineNo())); cur = CDR(cur);
    SETCAR(cur, ScalarInteger(err.getColumnNo())); cur = CDR(cur);
    SETCAR(cur, ScalarString(mkChar(err.getMessage().data())));
    Rf_eval(e, R_GlobalEnv);
    UNPROTECT(1);
}
开发者ID:doktorschiwago,项目名称:Rllvm2,代码行数:12,代码来源:IRBuilder.cpp

示例2: ConvertBackendLocation

/// InlineAsmDiagHandler2 - This function is invoked when the backend hits an
/// error parsing inline asm.  The SMDiagnostic indicates the error relative to
/// the temporary memory buffer that the inline asm parser has set up.
void BackendConsumer::InlineAsmDiagHandler2(const llvm::SMDiagnostic &D,
                                            SourceLocation LocCookie) {
  // There are a couple of different kinds of errors we could get here.  First,
  // we re-format the SMDiagnostic in terms of a clang diagnostic.

  // Strip "error: " off the start of the message string.
  StringRef Message = D.getMessage();
  if (Message.startswith("error: "))
    Message = Message.substr(7);

  // If the SMDiagnostic has an inline asm source location, translate it.
  FullSourceLoc Loc;
  if (D.getLoc() != SMLoc())
    Loc = ConvertBackendLocation(D, Context->getSourceManager());

  unsigned DiagID;
  switch (D.getKind()) {
  case llvm::SourceMgr::DK_Error:
    DiagID = diag::err_fe_inline_asm;
    break;
  case llvm::SourceMgr::DK_Warning:
    DiagID = diag::warn_fe_inline_asm;
    break;
  case llvm::SourceMgr::DK_Note:
    DiagID = diag::note_fe_inline_asm;
    break;
  case llvm::SourceMgr::DK_Remark:
    llvm_unreachable("remarks unexpected");
  }
  // If this problem has clang-level source location information, report the
  // issue in the source with a note showing the instantiated
  // code.
  if (LocCookie.isValid()) {
    Diags.Report(LocCookie, DiagID).AddString(Message);

    if (D.getLoc().isValid()) {
      DiagnosticBuilder B = Diags.Report(Loc, diag::note_fe_inline_asm_here);
      // Convert the SMDiagnostic ranges into SourceRange and attach them
      // to the diagnostic.
      for (const std::pair<unsigned, unsigned> &Range : D.getRanges()) {
        unsigned Column = D.getColumnNo();
        B << SourceRange(Loc.getLocWithOffset(Range.first - Column),
                         Loc.getLocWithOffset(Range.second - Column));
      }
    }
    return;
  }

  // Otherwise, report the backend issue as occurring in the generated .s file.
  // If Loc is invalid, we still need to report the issue, it just gets no
  // location info.
  Diags.Report(Loc, DiagID).AddString(Message);
}
开发者ID:Bekenn,项目名称:clang,代码行数:56,代码来源:CodeGenAction.cpp


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