[#llvm-SourceMgr] = xref:llvm.adoc[llvm]::SourceMgr :relfileprefix: ../ :mrdocs: This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling. == Synopsis Declared in `<llvm/Support/SourceMgr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class SourceMgr; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:llvm/SourceMgr/DiagHandlerTy.adoc[`DiagHandlerTy`] | Function pointer type for custom diagnostic handlers. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:llvm/SourceMgr/DiagKind.adoc[`DiagKind`] | Severity of a diagnostic message. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/SourceMgr/2constructor-0c2.adoc[`SourceMgr`] [.small]#[constructor]# | Constructors | xref:llvm/SourceMgr/2destructor.adoc[`~SourceMgr`] [.small]#[destructor]# | Destroy this source manager and its owned buffers. | xref:llvm/SourceMgr/operator_assign-02.adoc[`operator=`] | Assignment operators | xref:llvm/SourceMgr/AddIncludeFile.adoc[`AddIncludeFile`] | Search for a file with the specified name in the current directory or in one of the IncludeDirs. | xref:llvm/SourceMgr/AddNewSourceBuffer.adoc[`AddNewSourceBuffer`] | Add a new source buffer to this source manager. This takes ownership of the memory buffer. | xref:llvm/SourceMgr/FindBufferContainingLoc.adoc[`FindBufferContainingLoc`] | Return the ID of the buffer containing the specified location. | xref:llvm/SourceMgr/FindLineNumber.adoc[`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. | xref:llvm/SourceMgr/FindLocForLineAndColumn.adoc[`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. | xref:llvm/SourceMgr/GetMessage.adoc[`GetMessage`] | Return an SMDiagnostic at the specified location with the specified string. | xref:llvm/SourceMgr/OpenIncludeFile.adoc[`OpenIncludeFile`] | Open an include file without adding it to this SourceMgr. | xref:llvm/SourceMgr/PrintIncludeStack.adoc[`PrintIncludeStack`] | Print the include stack ending at `IncludeLoc` to `OS.` | xref:llvm/SourceMgr/PrintMessage-047.adoc[`PrintMessage`] | `PrintMessage` overloads | xref:llvm/SourceMgr/getBufferInfo.adoc[`getBufferInfo`] | Return buffer metadata for the buffer with ID `i.` | xref:llvm/SourceMgr/getDiagContext.adoc[`getDiagContext`] | Return the opaque context pointer passed to the diagnostic handler. | xref:llvm/SourceMgr/getDiagHandler.adoc[`getDiagHandler`] | Return the currently installed diagnostic handler, if any. | xref:llvm/SourceMgr/getFormattedLocationNoOffset.adoc[`getFormattedLocationNoOffset`] | Get a string with the `SMLoc` filename and line number formatted in the standard style. | xref:llvm/SourceMgr/getIncludeDirs.adoc[`getIncludeDirs`] | Return the include directories of this source manager. | xref:llvm/SourceMgr/getLineAndColumn.adoc[`getLineAndColumn`] | Return the line and column for `Loc` in the given buffer. | xref:llvm/SourceMgr/getMainFileID.adoc[`getMainFileID`] | Return the one‐based ID of the main (first) source buffer. | xref:llvm/SourceMgr/getMemoryBuffer.adoc[`getMemoryBuffer`] | Return the memory buffer for the buffer with ID `i.` | xref:llvm/SourceMgr/getNumBuffers.adoc[`getNumBuffers`] | Return the number of source buffers owned by this manager. | xref:llvm/SourceMgr/getParentIncludeLoc.adoc[`getParentIncludeLoc`] | Return the include location of the parent of buffer `i.` | xref:llvm/SourceMgr/getVirtualFileSystem.adoc[`getVirtualFileSystem`] | Return the virtual file system used to find include files. | xref:llvm/SourceMgr/printIncludeStackForDiagnostic.adoc[`printIncludeStackForDiagnostic`] | Prints the include stack of a buffer unless it is a macro instantiation buffer. | xref:llvm/SourceMgr/setDiagHandler.adoc[`setDiagHandler`] | Specify a diagnostic handler to be invoked every time PrintMessage is called. `Ctx` is passed into the handler when it is invoked. | xref:llvm/SourceMgr/setIncludeDirs.adoc[`setIncludeDirs`] | Replace the include search path with `Dirs.` | xref:llvm/SourceMgr/setVirtualFileSystem.adoc[`setVirtualFileSystem`] | Set the virtual file system used to find include files. | xref:llvm/SourceMgr/takeSourceBuffersFrom.adoc[`takeSourceBuffersFrom`] | Append all source buffers from `SrcMgr` into this manager. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:llvm/TableGenParseFile.adoc[`TableGenParseFile`] | Parse the TableGen file from the main buffer of a SourceMgr. | xref:llvm/createMCAsmParser.adoc[`createMCAsmParser`] | Create an MCAsmParser instance for parsing assembly similar to gas syntax. | xref:llvm/createMCMasmParser.adoc[`createMCMasmParser`] | Create an MCAsmParser instance for parsing Microsoft MASM‐style assembly. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#