This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling.

Synopsis

Declared in <llvm/Support/SourceMgr.h>

class SourceMgr;

Type Aliases

Name

Description

DiagHandlerTy

Function pointer type for custom diagnostic handlers.

Enums

Name

Description

DiagKind

Severity of a diagnostic message.

Member Functions

Name

Description

SourceMgr [constructor]

Constructors

~SourceMgr [destructor]

Destroy this source manager and its owned buffers.

operator=

Assignment operators

AddIncludeFile

Search for a file with the specified name in the current directory or in one of the IncludeDirs.

AddNewSourceBuffer

Add a new source buffer to this source manager. This takes ownership of the memory buffer.

FindBufferContainingLoc

Return the ID of the buffer containing the specified location.

FindLineNumber

Find the line number for the specified location in the specified file. This method has O(log n) complexity, where n is the number of lines in the buffer.

FindLocForLineAndColumn

Given a line and column number in a mapped buffer, turn it into an SMLoc. This will return a null SMLoc if the line/column location is invalid.

GetMessage

Return an SMDiagnostic at the specified location with the specified string.

OpenIncludeFile

Open an include file without adding it to this SourceMgr.

PrintIncludeStack

Print the include stack ending at IncludeLoc to OS.

PrintMessage

PrintMessage overloads

getBufferInfo

Return buffer metadata for the buffer with ID i.

getDiagContext

Return the opaque context pointer passed to the diagnostic handler.

getDiagHandler

Return the currently installed diagnostic handler, if any.

getFormattedLocationNoOffset

Get a string with the SMLoc filename and line number formatted in the standard style.

getIncludeDirs

Return the include directories of this source manager.

getLineAndColumn

Return the line and column for Loc in the given buffer.

getMainFileID

Return the one‐based ID of the main (first) source buffer.

getMemoryBuffer

Return the memory buffer for the buffer with ID i.

getNumBuffers

Return the number of source buffers owned by this manager.

getParentIncludeLoc

Return the include location of the parent of buffer i.

getVirtualFileSystem

Return the virtual file system used to find include files.

printIncludeStackForDiagnostic

Prints the include stack of a buffer unless it is a macro instantiation buffer.

setDiagHandler

Specify a diagnostic handler to be invoked every time PrintMessage is called. Ctx is passed into the handler when it is invoked.

setIncludeDirs

Replace the include search path with Dirs.

setVirtualFileSystem

Set the virtual file system used to find include files.

takeSourceBuffersFrom

Append all source buffers from SrcMgr into this manager.

Non-Member Functions

Name

Description

TableGenParseFile

Parse the TableGen file from the main buffer of a SourceMgr.

createMCAsmParser

Create an MCAsmParser instance for parsing assembly similar to gas syntax.

createMCMasmParser

Create an MCAsmParser instance for parsing Microsoft MASM‐style assembly.

Created with MrDocs