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


C++ PresumedLoc::getLine方法代码示例

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


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

示例1: emitImportLocation

void TextDiagnostic::emitImportLocation(SourceLocation Loc, PresumedLoc PLoc,
                                        StringRef ModuleName,
                                        const SourceManager &SM) {
  if (DiagOpts->ShowLocation && PLoc.isValid())
    OS << "In module '" << ModuleName << "' imported from "
       << PLoc.getFilename() << ':' << PLoc.getLine() << ":\n";
  else
    OS << "In module '" << ModuleName << "':\n";
}
开发者ID:AntonBikineev,项目名称:clang,代码行数:9,代码来源:TextDiagnostic.cpp

示例2: printSourceLocation

static void printSourceLocation(SourceLocation loc, ASTContext &Ctx,
                                raw_ostream &OS) {
  SourceManager &SM = Ctx.getSourceManager();
  PresumedLoc PL = SM.getPresumedLoc(loc);

  OS << llvm::sys::path::filename(PL.getFilename());
  OS << ":" << PL.getLine() << ":"
            << PL.getColumn();
}
开发者ID:realdelta,项目名称:delta-clang,代码行数:9,代码来源:arcmt-test.cpp

示例3: emitBuildingModuleLocation

void TextDiagnostic::emitBuildingModuleLocation(FullSourceLoc Loc,
                                                PresumedLoc PLoc,
                                                StringRef ModuleName) {
  if (DiagOpts->ShowLocation && PLoc.isValid())
    OS << "While building module '" << ModuleName << "' imported from "
      << PLoc.getFilename() << ':' << PLoc.getLine() << ":\n";
  else
    OS << "While building module '" << ModuleName << "':\n";
}
开发者ID:Teemperor,项目名称:clang,代码行数:9,代码来源:TextDiagnostic.cpp

示例4: emitIncludeLocation

void TextDiagnostic::emitIncludeLocation(SourceLocation Loc,
                                         PresumedLoc PLoc,
                                         const SourceManager &SM) {
  if (DiagOpts->ShowLocation && PLoc.isValid())
    OS << "In file included from " << PLoc.getFilename() << ':'
       << PLoc.getLine() << ":\n";
  else
    OS << "In included file:\n"; 
}
开发者ID:AntonBikineev,项目名称:clang,代码行数:9,代码来源:TextDiagnostic.cpp

示例5: emitBuildingPCModuleLocation

void TextDiagnostic::emitBuildingPCModuleLocation(SourceLocation Loc,
                                                PresumedLoc PLoc,
                                                StringRef PCModuleName,
                                                const SourceManager &SM) {
  if (DiagOpts->ShowLocation && PLoc.getFilename())
    OS << "While building module '" << PCModuleName << "' imported from "
      << PLoc.getFilename() << ':' << PLoc.getLine() << ":\n";
  else
    OS << "While building module '" << PCModuleName << "':\n";
}
开发者ID:gwelymernans,项目名称:lfort,代码行数:10,代码来源:TextDiagnostic.cpp

示例6: emitIncludeLocation

void DiagnosticNoteRenderer::emitIncludeLocation(SourceLocation Loc,
                                                 PresumedLoc PLoc,
                                                 const SourceManager &SM) {
  // Generate a note indicating the include location.
  SmallString<200> MessageStorage;
  llvm::raw_svector_ostream Message(MessageStorage);
  Message << "in file included from " << PLoc.getFilename() << ':'
          << PLoc.getLine() << ":";
  emitNote(Loc, Message.str(), &SM);
}
开发者ID:nico,项目名称:gong,代码行数:10,代码来源:DiagnosticRenderer.cpp

示例7: GetOrCreateDefaultOpenMPLocation

llvm::Value *CGOpenMPRuntime::EmitOpenMPUpdateLocation(
    CodeGenFunction &CGF, SourceLocation Loc, OpenMPLocationFlags Flags) {
  // If no debug info is generated - return global default location.
  if (CGM.getCodeGenOpts().getDebugInfo() == CodeGenOptions::NoDebugInfo ||
      Loc.isInvalid())
    return GetOrCreateDefaultOpenMPLocation(Flags);

  assert(CGF.CurFn && "No function in current CodeGenFunction.");

  llvm::Value *LocValue = nullptr;
  auto I = OpenMPLocThreadIDMap.find(CGF.CurFn);
  if (I != OpenMPLocThreadIDMap.end())
    LocValue = I->second.DebugLoc;
  // OpenMPLocThreadIDMap may have null DebugLoc and non-null ThreadID, if
  // GetOpenMPThreadID was called before this routine.
  if (LocValue == nullptr) {
    // Generate "ident_t .kmpc_loc.addr;"
    llvm::AllocaInst *AI = CGF.CreateTempAlloca(IdentTy, ".kmpc_loc.addr");
    AI->setAlignment(CGM.getDataLayout().getPrefTypeAlignment(IdentTy));
    auto &Elem = OpenMPLocThreadIDMap.FindAndConstruct(CGF.CurFn);
    Elem.second.DebugLoc = AI;
    LocValue = AI;

    CGBuilderTy::InsertPointGuard IPG(CGF.Builder);
    CGF.Builder.SetInsertPoint(CGF.AllocaInsertPt);
    CGF.Builder.CreateMemCpy(LocValue, GetOrCreateDefaultOpenMPLocation(Flags),
                             llvm::ConstantExpr::getSizeOf(IdentTy),
                             CGM.PointerAlignInBytes);
  }

  // char **psource = &.kmpc_loc_<flags>.addr.psource;
  auto *PSource =
      CGF.Builder.CreateConstInBoundsGEP2_32(LocValue, 0, IdentField_PSource);

  auto OMPDebugLoc = OpenMPDebugLocMap.lookup(Loc.getRawEncoding());
  if (OMPDebugLoc == nullptr) {
    SmallString<128> Buffer2;
    llvm::raw_svector_ostream OS2(Buffer2);
    // Build debug location
    PresumedLoc PLoc = CGF.getContext().getSourceManager().getPresumedLoc(Loc);
    OS2 << ";" << PLoc.getFilename() << ";";
    if (const FunctionDecl *FD =
            dyn_cast_or_null<FunctionDecl>(CGF.CurFuncDecl)) {
      OS2 << FD->getQualifiedNameAsString();
    }
    OS2 << ";" << PLoc.getLine() << ";" << PLoc.getColumn() << ";;";
    OMPDebugLoc = CGF.Builder.CreateGlobalStringPtr(OS2.str());
    OpenMPDebugLocMap[Loc.getRawEncoding()] = OMPDebugLoc;
  }
  // *psource = ";<File>;<Function>;<Line>;<Column>;;";
  CGF.Builder.CreateStore(OMPDebugLoc, PSource);

  return LocValue;
}
开发者ID:eGit,项目名称:clang,代码行数:54,代码来源:CGOpenMPRuntime.cpp

示例8: printSourceRange

static void printSourceRange(CharSourceRange range, ASTContext &Ctx,
                             raw_ostream &OS) {
  SourceManager &SM = Ctx.getSourceManager();
  const LangOptions &langOpts = Ctx.getLangOpts();

  PresumedLoc PL = SM.getPresumedLoc(range.getBegin());

  OS << llvm::sys::path::filename(PL.getFilename());
  OS << " [" << PL.getLine() << ":"
             << PL.getColumn();
  OS << " - ";

  SourceLocation end = range.getEnd();
  PL = SM.getPresumedLoc(end);

  unsigned endCol = PL.getColumn() - 1;
  if (!range.isTokenRange())
    endCol += Lexer::MeasureTokenLength(end, SM, langOpts);
  OS << PL.getLine() << ":" << endCol << "]";
}
开发者ID:CSI-LLVM,项目名称:clang,代码行数:20,代码来源:arcmt-test.cpp

示例9: pl_getPresumedLoc

 foreign_t pl_getPresumedLoc(term_t DeclT, term_t FilenameT,
                             term_t LineT, term_t ColT) {
   const Decl *D;
   if ( !PL_get_pointer(DeclT, (void **) &D))
     return PL_warning("getPresumedLoc/4: instantiation fault on first arg");
   const SourceManager &SM = getCompilationInfo()->getSourceManager();
   const PresumedLoc PL = SM.getPresumedLoc(D->getLocation());
   if ( !PL_unify_atom_chars(FilenameT, PL.getFilename())) return FALSE;
   if ( !PL_unify_int64(LineT, (int64_t) PL.getLine())) return FALSE;
   return PL_unify_int64(ColT, (int64_t) PL.getColumn());
 }
开发者ID:ajasmin,项目名称:Crisp,代码行数:11,代码来源:ClangPrologPredicates.cpp

示例10: GetLocString

std::string BlinkGCPluginConsumer::GetLocString(SourceLocation loc) {
  const SourceManager& source_manager = instance_.getSourceManager();
  PresumedLoc ploc = source_manager.getPresumedLoc(loc);
  if (ploc.isInvalid())
    return "";
  std::string loc_str;
  llvm::raw_string_ostream os(loc_str);
  os << ploc.getFilename()
     << ":" << ploc.getLine()
     << ":" << ploc.getColumn();
  return os.str();
}
开发者ID:Crawping,项目名称:chromium_extract,代码行数:12,代码来源:BlinkGCPluginConsumer.cpp

示例11: Message

void
DiagnosticNoteRenderer::emitBuildingModuleLocation(SourceLocation Loc,
                                                   PresumedLoc PLoc,
                                                   StringRef ModuleName,
                                                   const SourceManager &SM) {
  // Generate a note indicating the include location.
  SmallString<200> MessageStorage;
  llvm::raw_svector_ostream Message(MessageStorage);
  Message << "while building module '" << ModuleName << "' imported from "
          << PLoc.getFilename() << ':' << PLoc.getLine() << ":";
  emitNote(Loc, Message.str(), &SM);
}
开发者ID:nico,项目名称:gong,代码行数:12,代码来源:DiagnosticRenderer.cpp

示例12:

llvm::MDNode *SanitizerMetadata::getLocationMetadata(SourceLocation Loc) {
  PresumedLoc PLoc = CGM.getContext().getSourceManager().getPresumedLoc(Loc);
  if (!PLoc.isValid())
    return nullptr;
  llvm::LLVMContext &VMContext = CGM.getLLVMContext();
  llvm::Value *LocMetadata[] = {
      llvm::MDString::get(VMContext, PLoc.getFilename()),
      llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), PLoc.getLine()),
      llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext),
                             PLoc.getColumn()),
  };
  return llvm::MDNode::get(VMContext, LocMetadata);
}
开发者ID:MarkTseng,项目名称:clang,代码行数:13,代码来源:SanitizerMetadata.cpp

示例13: PrintIncludeStack

void TextDiagnosticPrinter::
PrintIncludeStack(SourceLocation Loc, const SourceManager &SM) {
  if (Loc.isInvalid()) return;

  PresumedLoc PLoc = SM.getPresumedLoc(Loc);

  // Print out the other include frames first.
  PrintIncludeStack(PLoc.getIncludeLoc(), SM);

  if (DiagOpts->ShowLocation)
    OS << "In file included from " << PLoc.getFilename()
       << ':' << PLoc.getLine() << ":\n";
  else
    OS << "In included file:\n";
}
开发者ID:HenderOrlando,项目名称:clamav-bytecode-compiler,代码行数:15,代码来源:TextDiagnosticPrinter.cpp

示例14: addLocation

//---------------------------------------------------------
PresumedLoc DocumentXML::addLocation(const SourceLocation& Loc)
{
  SourceManager& SM = Ctx->getSourceManager();
  SourceLocation SpellingLoc = SM.getSpellingLoc(Loc);
  PresumedLoc PLoc;
  if (!SpellingLoc.isInvalid())
  {
    PLoc = SM.getPresumedLoc(SpellingLoc);
    addSourceFileAttribute(PLoc.getFilename());
    addAttribute("line", PLoc.getLine());
    addAttribute("col", PLoc.getColumn());
  }
  // else there is no error in some cases (eg. CXXThisExpr)
  return PLoc;
}
开发者ID:HenderOrlando,项目名称:clamav-bytecode-compiler,代码行数:16,代码来源:DocumentXML.cpp

示例15: emitIncludeStackRecursively

/// \brief Helper to recursivly walk up the include stack and print each layer
/// on the way back down.
void TextDiagnostic::emitIncludeStackRecursively(SourceLocation Loc) {
    if (Loc.isInvalid())
        return;

    PresumedLoc PLoc = SM.getPresumedLoc(Loc);
    if (PLoc.isInvalid())
        return;

    // Emit the other include frames first.
    emitIncludeStackRecursively(PLoc.getIncludeLoc());

    if (DiagOpts.ShowLocation)
        OS << "In file included from " << PLoc.getFilename()
           << ':' << PLoc.getLine() << ":\n";
    else
        OS << "In included file:\n";
}
开发者ID:avakar,项目名称:clang,代码行数:19,代码来源:TextDiagnostic.cpp


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