class SourceManager
Declaration
class SourceManager : public RefCountedBase { /* full declaration omitted */ };
Description
This class handles loading and caching of source files into memory. This object owns the MemoryBuffer objects for all of the loaded files and assigns unique FileID's for each unique # include chain. The SourceManager can be queried for information about SourceLocation objects, turning them into either spelling or expansion locations. Spelling locations represent where the bytes corresponding to a token came from and expansion locations represent where the location is in the user's view. In the case of a macro expansion, for example, the spelling location indicates where the expanded token came from and the expansion location specifies where it was expanded.
Declared at: clang/include/clang/Basic/SourceManager.h:627
Inherits from: RefCountedBase
Member Variables
- private clang::DiagnosticsEngine& Diag
- DiagnosticsEngine object.
- private clang::FileManager& FileMgr
- private llvm::BumpPtrAllocator ContentCacheAlloc
- private llvm::DenseMap<const FileEntry*, SrcMgr::ContentCache*> FileInfos
- This map allows us to merge ContentCache entries based on their FileEntry*. All ContentCache objects will thus have unique, non-null, FileEntry pointers.
- private bool OverridenFilesKeepOriginalName = true
- True if the ContentCache for files that are overridden by other files, should report the original file name. Defaults to true.
- private bool UserFilesAreVolatile
- True if non-system source files should be treated as volatile (likely to change while trying to use them). Defaults to false.
- private bool FilesAreTransient = false
- True if all files read during this compilation should be treated as transient (may not be present in later compilations using a module file created from this compilation). Defaults to false.
- private std::unique_ptr<OverriddenFilesInfoTy> OverriddenFilesInfo
- Lazily create the object keeping overridden files info, since it is uncommonly used.
- private std::vector<SrcMgr::ContentCache*> MemBufferInfos
- All FileEntry* within the stored ContentCache objects are NULL, as they do not refer to a file.
- private SmallVector<SrcMgr::SLocEntry, 0> LocalSLocEntryTable
- Positive FileIDs are indexes into this table. Entry 0 indicates an invalid expansion.
- private SmallVector<SrcMgr::SLocEntry, 0> LoadedSLocEntryTable
- Negative FileIDs are indexes into this table. To get from ID to an index, use (-ID - 2).
- private SourceLocation::UIntTy NextLocalOffset
- This is LocalSLocEntryTable.back().Offset + the size of that entry.
- private SourceLocation::UIntTy CurrentLoadedOffset
- This is LoadedSLocEntryTable.back().Offset, except that that entry might not have been loaded, so that value would be unknown.
- private llvm::BitVector SLocEntryLoaded
- Same indexing as LoadedSLocEntryTable.
- private clang::ExternalSLocEntrySource* ExternalSLocEntries = nullptr
- An external source for source location entries.
- private clang::FileID LastFileIDLookup
- LastFileIDLookup records the last FileID looked up or created, because it is very common to look up many tokens from the same file.
- private std::unique_ptr<LineTableInfo> LineTable
- This is referenced by indices from SLocEntryTable.
- private clang::FileID LastLineNoFileIDQuery
- These ivars serve as a cache used in the getLineNumber method which is used to speedup getLineNumber calls to nearby locations.
- private const SrcMgr::ContentCache* LastLineNoContentCache
- private unsigned int LastLineNoFilePos
- private unsigned int LastLineNoResult
- private clang::FileID MainFileID
- The file ID for the main source file of the translation unit.
- private clang::FileID PreambleFileID
- The file ID for the precompiled preamble there is one.
- private unsigned int NumLinearScans = 0
- private unsigned int NumBinaryProbes = 0
- private llvm::DenseMap<FileID, std::pair<FileID, unsigned int>> IncludedLocMap
- Used to cache results from and speed-up \c getDecomposedIncludedLoc function.
- private clang::SourceManager::InBeforeInTUCache IBTUCache
- Cache results for the isBeforeInTranslationUnit method.
- private clang::InBeforeInTUCacheEntry IBTUCacheOverflow
- private std::unique_ptr<llvm::MemoryBuffer> FakeBufferForRecovery
- private std::unique_ptr<SrcMgr::ContentCache> FakeContentCacheForRecovery
- private std::unique_ptr<SrcMgr::SLocEntry> FakeSLocEntryForRecovery
- private llvm::DenseMap<FileID, std::unique_ptr<MacroArgsMap>> MacroArgsCacheMap
- private SmallVector<std::pair<std::string, FullSourceLoc>, 2> StoredModuleBuildStack
- There is no way to set this value from the command line. If we ever need to do so (e.g., if on-demand module construction moves out-of-process), we can add a cc1-level option to do so.
- private static const SourceLocation::UIntTy MaxLoadedOffset = 1ULL << (8 * sizeof(unsigned int) - 1)
- The highest possible offset is 2^32-1 (2^63-1 for 64-bit source locations), so CurrentLoadedOffset starts at 2^31 (2^63 resp.).
Method Overview
- public void AddLineNote(clang::SourceLocation Loc, unsigned int LineNo, int FilenameID, bool IsFileEntry, bool IsFileExit, SrcMgr::CharacteristicKind FileKind)
- public std::pair<int, SourceLocation::UIntTy> AllocateLoadedSLocEntries(unsigned int NumSLocEntries, SourceLocation::UIntTy TotalSize)
- public void PrintStats() const
- public SourceManager(clang::DiagnosticsEngine & Diag, clang::FileManager & FileMgr, bool UserFilesAreVolatile = false)
- public SourceManager(const clang::SourceManager &)
- private void associateFileChunkWithMacroArgExp(clang::SourceManager::MacroArgsMap & MacroArgsCache, clang::FileID FID, clang::SourceLocation SpellLoc, clang::SourceLocation ExpansionLoc, unsigned int ExpansionLength) const
- public Optional<clang::FileEntryRef> bypassFileContentsOverride(clang::FileEntryRef File)
- public void clearIDTables()
- private void computeMacroArgsCache(clang::SourceManager::MacroArgsMap & MacroArgsCache, clang::FileID FID) const
- public clang::SourceLocation createExpansionLoc(clang::SourceLocation SpellingLoc, clang::SourceLocation ExpansionLocStart, clang::SourceLocation ExpansionLocEnd, unsigned int Length, bool ExpansionIsTokenRange = true, int LoadedID = 0, SourceLocation::UIntTy LoadedOffset = 0)
- private clang::SourceLocation createExpansionLocImpl(const SrcMgr::ExpansionInfo & Expansion, unsigned int Length, int LoadedID = 0, SourceLocation::UIntTy LoadedOffset = 0)
- public clang::FileID createFileID(const llvm::MemoryBufferRef & Buffer, SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User, int LoadedID = 0, SourceLocation::UIntTy LoadedOffset = 0, clang::SourceLocation IncludeLoc = clang::SourceLocation())
- public clang::FileID createFileID(std::unique_ptr<llvm::MemoryBuffer> Buffer, SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User, int LoadedID = 0, SourceLocation::UIntTy LoadedOffset = 0, clang::SourceLocation IncludeLoc = clang::SourceLocation())
- public clang::FileID createFileID(clang::FileEntryRef SourceFile, clang::SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID = 0, SourceLocation::UIntTy LoadedOffset = 0)
- public clang::FileID createFileID(const clang::FileEntry * SourceFile, clang::SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID = 0, SourceLocation::UIntTy LoadedOffset = 0)
- private clang::FileID createFileIDImpl(SrcMgr::ContentCache & File, llvm::StringRef Filename, clang::SourceLocation IncludePos, SrcMgr::CharacteristicKind DirCharacter, int LoadedID, SourceLocation::UIntTy LoadedOffset)
- public clang::SourceLocation createMacroArgExpansionLoc(clang::SourceLocation SpellingLoc, clang::SourceLocation ExpansionLoc, unsigned int Length)
- private SrcMgr::ContentCache & createMemBufferContentCache(std::unique_ptr<llvm::MemoryBuffer> Buf)
- public clang::SourceLocation createTokenSplitLoc(clang::SourceLocation SpellingLoc, clang::SourceLocation TokenStart, clang::SourceLocation TokenEnd)
- public void dump() const
- public clang::SourceManager::fileinfo_iterator fileinfo_begin() const
- public clang::SourceManager::fileinfo_iterator fileinfo_end() const
- public llvm::StringRef getBufferData(clang::FileID FID, bool * Invalid = nullptr) const
- public llvm::Optional<StringRef> getBufferDataIfLoaded(clang::FileID FID) const
- public llvm::Optional<StringRef> getBufferDataOrNone(clang::FileID FID) const
- public llvm::StringRef getBufferName(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public llvm::MemoryBufferRef getBufferOrFake(clang::FileID FID, clang::SourceLocation Loc = clang::SourceLocation()) const
- public llvm::Optional<llvm::MemoryBufferRef> getBufferOrNone(clang::FileID FID, clang::SourceLocation Loc = clang::SourceLocation()) const
- public const char * getCharacterData(clang::SourceLocation SL, bool * Invalid = nullptr) const
- public unsigned int getColumnNumber(clang::FileID FID, unsigned int FilePos, bool * Invalid = nullptr) const
- public clang::SourceLocation getComposedLoc(clang::FileID FID, unsigned int Offset) const
- public size_t getContentCacheSize() const
- public size_t getDataStructureSizes() const
- public std::pair<FileID, unsigned int> getDecomposedExpansionLoc(clang::SourceLocation Loc) const
- private std::pair<FileID, unsigned int> getDecomposedExpansionLocSlowCase(const SrcMgr::SLocEntry * E) const
- public std::pair<FileID, unsigned int> getDecomposedIncludedLoc(clang::FileID FID) const
- public std::pair<FileID, unsigned int> getDecomposedLoc(clang::SourceLocation Loc) const
- public std::pair<FileID, unsigned int> getDecomposedSpellingLoc(clang::SourceLocation Loc) const
- private std::pair<FileID, unsigned int> getDecomposedSpellingLocSlowCase(const SrcMgr::SLocEntry * E, unsigned int Offset) const
- public clang::DiagnosticsEngine & getDiagnostics() const
- public unsigned int getExpansionColumnNumber(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public unsigned int getExpansionLineNumber(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public clang::SourceLocation getExpansionLoc(clang::SourceLocation Loc) const
- private clang::SourceLocation getExpansionLocSlowCase(clang::SourceLocation Loc) const
- public clang::CharSourceRange getExpansionRange(clang::CharSourceRange Range) const
- public clang::CharSourceRange getExpansionRange(clang::SourceRange Range) const
- public clang::CharSourceRange getExpansionRange(clang::SourceLocation Loc) const
- private llvm::MemoryBufferRef getFakeBufferForRecovery() const
- private SrcMgr::ContentCache & getFakeContentCacheForRecovery() const
- public SrcMgr::CharacteristicKind getFileCharacteristic(clang::SourceLocation Loc) const
- public const clang::FileEntry * getFileEntryForID(clang::FileID FID) const
- public const clang::FileEntry * getFileEntryForSLocEntry(const SrcMgr::SLocEntry & sloc) const
- public Optional<clang::FileEntryRef> getFileEntryRefForID(clang::FileID FID) const
- public clang::FileID getFileID(clang::SourceLocation SpellingLoc) const
- private clang::FileID getFileIDLoaded(SourceLocation::UIntTy SLocOffset) const
- private clang::FileID getFileIDLocal(SourceLocation::UIntTy SLocOffset) const
- public unsigned int getFileIDSize(clang::FileID FID) const
- private clang::FileID getFileIDSlow(SourceLocation::UIntTy SLocOffset) const
- public clang::SourceLocation getFileLoc(clang::SourceLocation Loc) const
- private clang::SourceLocation getFileLocSlowCase(clang::SourceLocation Loc) const
- public clang::FileManager & getFileManager() const
- public unsigned int getFileOffset(clang::SourceLocation SpellingLoc) const
- public llvm::StringRef getFilename(clang::SourceLocation SpellingLoc) const
- public clang::CharSourceRange getImmediateExpansionRange(clang::SourceLocation Loc) const
- public clang::SourceLocation getImmediateMacroCallerLoc(clang::SourceLocation Loc) const
- public clang::SourceLocation getImmediateSpellingLoc(clang::SourceLocation Loc) const
- private clang::InBeforeInTUCacheEntry & getInBeforeInTUCache(clang::FileID LFID, clang::FileID RFID) const
- public clang::SourceLocation getIncludeLoc(clang::FileID FID) const
- public unsigned int getLineNumber(clang::FileID FID, unsigned int FilePos, bool * Invalid = nullptr) const
- public clang::LineTableInfo & getLineTable()
- public unsigned int getLineTableFilenameID(llvm::StringRef Str)
- public const SrcMgr::SLocEntry & getLoadedSLocEntry(unsigned int Index, bool * Invalid = nullptr) const
- private const SrcMgr::SLocEntry & getLoadedSLocEntryByID(int ID, bool * Invalid = nullptr) const
- public clang::SourceLocation getLocForEndOfFile(clang::FileID FID) const
- public clang::SourceLocation getLocForStartOfFile(clang::FileID FID) const
- public const SrcMgr::SLocEntry & getLocalSLocEntry(unsigned int Index) const
- public clang::SourceLocation getMacroArgExpandedLocation(clang::SourceLocation Loc) const
- public clang::FileID getMainFileID() const
- public llvm::MemoryBufferRef getMemoryBufferForFileOrFake(const clang::FileEntry * File)
- public llvm::Optional<llvm::MemoryBufferRef> getMemoryBufferForFileOrNone(const clang::FileEntry * File)
- public clang::SourceManager::MemoryBufferSizes getMemoryBufferSizes() const
- public clang::ModuleBuildStack getModuleBuildStack() const
- public std::pair<SourceLocation, StringRef> getModuleImportLoc(clang::SourceLocation Loc) const
- private clang::FileID getNextFileID(clang::FileID FID) const
- public SourceLocation::UIntTy getNextLocalOffset() const
- public Optional<llvm::StringRef> getNonBuiltinFilenameForID(clang::FileID FID) const
- public unsigned int getNumCreatedFIDsForFileID(clang::FileID FID) const
- private SrcMgr::ContentCache & getOrCreateContentCache(clang::FileEntryRef SourceFile, bool isSystemFile = false)
- public clang::FileID getOrCreateFileID(const clang::FileEntry * SourceFile, SrcMgr::CharacteristicKind FileCharacter)
- private clang::SourceManager::OverriddenFilesInfoTy & getOverriddenFilesInfo()
- public clang::FileID getPreambleFileID() const
- public unsigned int getPresumedColumnNumber(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public unsigned int getPresumedLineNumber(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public clang::PresumedLoc getPresumedLoc(clang::SourceLocation Loc, bool UseLineDirectives = true) const
- private clang::FileID getPreviousFileID(clang::FileID FID) const
- public const SrcMgr::SLocEntry & getSLocEntry(clang::FileID FID, bool * Invalid = nullptr) const
- private const SrcMgr::SLocEntry & getSLocEntryByID(int ID, bool * Invalid = nullptr) const
- private const SrcMgr::SLocEntry * getSLocEntryForFile(clang::FileID FID) const
- private const SrcMgr::SLocEntry * getSLocEntryOrNull(clang::FileID FID) const
- public unsigned int getSpellingColumnNumber(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public unsigned int getSpellingLineNumber(clang::SourceLocation Loc, bool * Invalid = nullptr) const
- public clang::SourceLocation getSpellingLoc(clang::SourceLocation Loc) const
- private clang::SourceLocation getSpellingLocSlowCase(clang::SourceLocation Loc) const
- public clang::SourceLocation getTopMacroCallerLoc(clang::SourceLocation Loc) const
- public bool hasFileInfo(const clang::FileEntry * File) const
- public bool hasLineTable() const
- public void initializeForReplay(const clang::SourceManager & Old)
- public bool isAtEndOfImmediateMacroExpansion(clang::SourceLocation Loc, clang::SourceLocation * MacroEnd = nullptr) const
- public bool isAtStartOfImmediateMacroExpansion(clang::SourceLocation Loc, clang::SourceLocation * MacroBegin = nullptr) const
- public bool isBeforeInSLocAddrSpace(clang::SourceLocation LHS, SourceLocation::UIntTy RHS) const
- public bool isBeforeInSLocAddrSpace(clang::SourceLocation LHS, clang::SourceLocation RHS) const
- public bool isBeforeInTranslationUnit(clang::SourceLocation LHS, clang::SourceLocation RHS) const
- public bool isFileOverridden(const clang::FileEntry * File) const
- public bool isInExternCSystemHeader(clang::SourceLocation Loc) const
- public bool isInFileID(clang::SourceLocation Loc, clang::FileID FID, unsigned int * RelativeOffset = nullptr) const
- public bool isInMainFile(clang::SourceLocation Loc) const
- public bool isInSLocAddrSpace(clang::SourceLocation Loc, clang::SourceLocation Start, unsigned int Length, SourceLocation::UIntTy * RelativeOffset = nullptr) const
- public bool isInSameSLocAddrSpace(clang::SourceLocation LHS, clang::SourceLocation RHS, SourceLocation::IntTy * RelativeOffset) const
- public bool isInSystemHeader(clang::SourceLocation Loc) const
- public bool isInSystemMacro(clang::SourceLocation loc) const
- public std::pair<bool, bool> isInTheSameTranslationUnit(std::pair<FileID, unsigned int> & LOffs, std::pair<FileID, unsigned int> & ROffs) const
- public bool isLoadedFileID(clang::FileID FID) const
- public bool isLoadedSourceLocation(clang::SourceLocation Loc) const
- public bool isLocalFileID(clang::FileID FID) const
- public bool isLocalSourceLocation(clang::SourceLocation Loc) const
- public bool isMacroArgExpansion(clang::SourceLocation Loc, clang::SourceLocation * StartLoc = nullptr) const
- public bool isMacroBodyExpansion(clang::SourceLocation Loc) const
- public bool isMainFile(const clang::FileEntry & SourceFile)
- private inline bool isOffsetInFileID(clang::FileID FID, SourceLocation::UIntTy SLocOffset) const
- public bool isPointWithin(clang::SourceLocation Location, clang::SourceLocation Start, clang::SourceLocation End) const
- public bool isWrittenInBuiltinFile(clang::SourceLocation Loc) const
- public bool isWrittenInCommandLineFile(clang::SourceLocation Loc) const
- public bool isWrittenInMainFile(clang::SourceLocation Loc) const
- public bool isWrittenInSameFile(clang::SourceLocation Loc1, clang::SourceLocation Loc2) const
- public bool isWrittenInScratchSpace(clang::SourceLocation Loc) const
- private const SrcMgr::SLocEntry & loadSLocEntry(unsigned int Index, bool * Invalid) const
- public unsigned int loaded_sloc_entry_size() const
- public unsigned int local_sloc_entry_size() const
- public void overrideFileContents(const clang::FileEntry * SourceFile, const clang::FileEntry * NewFile)
- public void overrideFileContents(clang::FileEntryRef SourceFile, std::unique_ptr<llvm::MemoryBuffer> Buffer)
- public void overrideFileContents(const clang::FileEntry * SourceFile, std::unique_ptr<llvm::MemoryBuffer> Buffer)
- public void overrideFileContents(const clang::FileEntry * SourceFile, const llvm::MemoryBufferRef & Buffer)
- public void pushModuleBuildStack(llvm::StringRef moduleName, clang::FullSourceLoc importLoc)
- public void setAllFilesAreTransient(bool Transient)
- public void setExternalSLocEntrySource(clang::ExternalSLocEntrySource * Source)
- public void setFileIsTransient(const clang::FileEntry * SourceFile)
- public void setMainFileID(clang::FileID FID)
- public void setModuleBuildStack(clang::ModuleBuildStack stack)
- public void setNumCreatedFIDsForFileID(clang::FileID FID, unsigned int NumFIDs, bool Force = false) const
- public void setOverridenFilesKeepOriginalName(bool value)
- public void setPreambleFileID(clang::FileID Preamble)
- public clang::FileID translateFile(clang::FileEntryRef SourceFile) const
- public clang::FileID translateFile(const clang::FileEntry * SourceFile) const
- public clang::SourceLocation translateFileLineCol(const clang::FileEntry * SourceFile, unsigned int Line, unsigned int Col) const
- public clang::SourceLocation translateLineCol(clang::FileID FID, unsigned int Line, unsigned int Col) const
- public bool userFilesAreVolatile() const
- public ~SourceManager()
Methods
¶void AddLineNote(
clang::SourceLocation Loc,
unsigned int LineNo,
int FilenameID,
bool IsFileEntry,
bool IsFileExit,
SrcMgr::CharacteristicKind FileKind)
void AddLineNote(
clang::SourceLocation Loc,
unsigned int LineNo,
int FilenameID,
bool IsFileEntry,
bool IsFileExit,
SrcMgr::CharacteristicKind FileKind)
Description
Add a line note to the line table for the FileID and offset specified by Loc. If FilenameID is -1, it is considered to be unspecified.
Declared at: clang/include/clang/Basic/SourceManager.h:1560
Parameters
- clang::SourceLocation Loc
- unsigned int LineNo
- int FilenameID
- bool IsFileEntry
- bool IsFileExit
- SrcMgr::CharacteristicKind FileKind
¶std::pair<int, SourceLocation::UIntTy>
AllocateLoadedSLocEntries(
unsigned int NumSLocEntries,
SourceLocation::UIntTy TotalSize)
std::pair<int, SourceLocation::UIntTy>
AllocateLoadedSLocEntries(
unsigned int NumSLocEntries,
SourceLocation::UIntTy TotalSize)
Description
Allocate a number of loaded SLocEntries, which will be actually loaded on demand from the external source. NumSLocEntries will be allocated, which occupy a total of TotalSize space in the global source view. The lowest ID and the base offset of the entries will be returned.
Declared at: clang/include/clang/Basic/SourceManager.h:1737
Parameters
- unsigned int NumSLocEntries
- SourceLocation::UIntTy TotalSize
¶void PrintStats() const
void PrintStats() const
Description
Print statistics to stderr.
Declared at: clang/include/clang/Basic/SourceManager.h:1688
¶SourceManager(clang::DiagnosticsEngine& Diag,
clang::FileManager& FileMgr,
bool UserFilesAreVolatile = false)
SourceManager(clang::DiagnosticsEngine& Diag,
clang::FileManager& FileMgr,
bool UserFilesAreVolatile = false)
Declared at: clang/include/clang/Basic/SourceManager.h:793
Parameters
- clang::DiagnosticsEngine& Diag
- clang::FileManager& FileMgr
- bool UserFilesAreVolatile = false
¶SourceManager(const clang::SourceManager&)
SourceManager(const clang::SourceManager&)
Declared at: clang/include/clang/Basic/SourceManager.h:795
Parameters
- const clang::SourceManager&
¶void associateFileChunkWithMacroArgExp(
clang::SourceManager::MacroArgsMap&
MacroArgsCache,
clang::FileID FID,
clang::SourceLocation SpellLoc,
clang::SourceLocation ExpansionLoc,
unsigned int ExpansionLength) const
void associateFileChunkWithMacroArgExp(
clang::SourceManager::MacroArgsMap&
MacroArgsCache,
clang::FileID FID,
clang::SourceLocation SpellLoc,
clang::SourceLocation ExpansionLoc,
unsigned int ExpansionLength) const
Declared at: clang/include/clang/Basic/SourceManager.h:1884
Parameters
- clang::SourceManager::MacroArgsMap& MacroArgsCache
- clang::FileID FID
- clang::SourceLocation SpellLoc
- clang::SourceLocation ExpansionLoc
- unsigned int ExpansionLength
¶Optional<clang::FileEntryRef>
bypassFileContentsOverride(
clang::FileEntryRef File)
Optional<clang::FileEntryRef>
bypassFileContentsOverride(
clang::FileEntryRef File)
Description
Bypass the overridden contents of a file. This creates a new FileEntry and initializes the content cache for it. Returns None if there is no such file in the filesystem. This should be called before parsing has begun.
Declared at: clang/include/clang/Basic/SourceManager.h:997
Parameters
- clang::FileEntryRef File
¶void clearIDTables()
void clearIDTables()
Declared at: clang/include/clang/Basic/SourceManager.h:799
¶void computeMacroArgsCache(
clang::SourceManager::MacroArgsMap&
MacroArgsCache,
clang::FileID FID) const
void computeMacroArgsCache(
clang::SourceManager::MacroArgsMap&
MacroArgsCache,
clang::FileID FID) const
Declared at: clang/include/clang/Basic/SourceManager.h:1883
Parameters
- clang::SourceManager::MacroArgsMap& MacroArgsCache
- clang::FileID FID
¶clang::SourceLocation createExpansionLoc(
clang::SourceLocation SpellingLoc,
clang::SourceLocation ExpansionLocStart,
clang::SourceLocation ExpansionLocEnd,
unsigned int Length,
bool ExpansionIsTokenRange = true,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
clang::SourceLocation createExpansionLoc(
clang::SourceLocation SpellingLoc,
clang::SourceLocation ExpansionLocStart,
clang::SourceLocation ExpansionLocEnd,
unsigned int Length,
bool ExpansionIsTokenRange = true,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
Description
Creates an expansion SLocEntry for a macro use. Returns its start. The macro body begins at \p SpellingLoc with length \p Length. The macro use spans [ExpansionLocStart, ExpansionLocEnd].
Declared at: clang/include/clang/Basic/SourceManager.h:916
Parameters
- clang::SourceLocation SpellingLoc
- clang::SourceLocation ExpansionLocStart
- clang::SourceLocation ExpansionLocEnd
- unsigned int Length
- bool ExpansionIsTokenRange = true
- int LoadedID = 0
- SourceLocation::UIntTy LoadedOffset = 0
¶clang::SourceLocation createExpansionLocImpl(
const SrcMgr::ExpansionInfo& Expansion,
unsigned int Length,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
clang::SourceLocation createExpansionLocImpl(
const SrcMgr::ExpansionInfo& Expansion,
unsigned int Length,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
Description
Implements the common elements of storing an expansion info struct into the SLocEntry table and producing a source location that refers to it.
Declared at: clang/include/clang/Basic/SourceManager.h:1820
Parameters
- const SrcMgr::ExpansionInfo& Expansion
- unsigned int Length
- int LoadedID = 0
- SourceLocation::UIntTy LoadedOffset = 0
¶clang::FileID createFileID(
const llvm::MemoryBufferRef& Buffer,
SrcMgr::CharacteristicKind FileCharacter =
SrcMgr::C_User,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0,
clang::SourceLocation IncludeLoc =
clang::SourceLocation())
clang::FileID createFileID(
const llvm::MemoryBufferRef& Buffer,
SrcMgr::CharacteristicKind FileCharacter =
SrcMgr::C_User,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0,
clang::SourceLocation IncludeLoc =
clang::SourceLocation())
Description
Create a new FileID that represents the specified memory buffer. This does not take ownership of the MemoryBuffer. The memory buffer must outlive the SourceManager.
Declared at: clang/include/clang/Basic/SourceManager.h:893
Parameters
- const llvm::MemoryBufferRef& Buffer
- SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User
- int LoadedID = 0
- SourceLocation::UIntTy LoadedOffset = 0
- clang::SourceLocation IncludeLoc = clang::SourceLocation()
¶clang::FileID createFileID(
std::unique_ptr<llvm::MemoryBuffer> Buffer,
SrcMgr::CharacteristicKind FileCharacter =
SrcMgr::C_User,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0,
clang::SourceLocation IncludeLoc =
clang::SourceLocation())
clang::FileID createFileID(
std::unique_ptr<llvm::MemoryBuffer> Buffer,
SrcMgr::CharacteristicKind FileCharacter =
SrcMgr::C_User,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0,
clang::SourceLocation IncludeLoc =
clang::SourceLocation())
Description
Create a new FileID that represents the specified memory buffer. This does no caching of the buffer and takes ownership of the MemoryBuffer, so only pass a MemoryBuffer to this once.
Declared at: clang/include/clang/Basic/SourceManager.h:884
Parameters
- std::unique_ptr<llvm::MemoryBuffer> Buffer
- SrcMgr::CharacteristicKind FileCharacter = SrcMgr::C_User
- int LoadedID = 0
- SourceLocation::UIntTy LoadedOffset = 0
- clang::SourceLocation IncludeLoc = clang::SourceLocation()
¶clang::FileID createFileID(
clang::FileEntryRef SourceFile,
clang::SourceLocation IncludePos,
SrcMgr::CharacteristicKind FileCharacter,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
clang::FileID createFileID(
clang::FileEntryRef SourceFile,
clang::SourceLocation IncludePos,
SrcMgr::CharacteristicKind FileCharacter,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
Declared at: clang/include/clang/Basic/SourceManager.h:875
Parameters
- clang::FileEntryRef SourceFile
- clang::SourceLocation IncludePos
- SrcMgr::CharacteristicKind FileCharacter
- int LoadedID = 0
- SourceLocation::UIntTy LoadedOffset = 0
¶clang::FileID createFileID(
const clang::FileEntry* SourceFile,
clang::SourceLocation IncludePos,
SrcMgr::CharacteristicKind FileCharacter,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
clang::FileID createFileID(
const clang::FileEntry* SourceFile,
clang::SourceLocation IncludePos,
SrcMgr::CharacteristicKind FileCharacter,
int LoadedID = 0,
SourceLocation::UIntTy LoadedOffset = 0)
Description
Create a new FileID that represents the specified file being # included from the specified IncludePosition. This translates NULL into standard input.
Declared at: clang/include/clang/Basic/SourceManager.h:870
Parameters
- const clang::FileEntry* SourceFile
- clang::SourceLocation IncludePos
- SrcMgr::CharacteristicKind FileCharacter
- int LoadedID = 0
- SourceLocation::UIntTy LoadedOffset = 0
¶clang::FileID createFileIDImpl(
SrcMgr::ContentCache& File,
llvm::StringRef Filename,
clang::SourceLocation IncludePos,
SrcMgr::CharacteristicKind DirCharacter,
int LoadedID,
SourceLocation::UIntTy LoadedOffset)
clang::FileID createFileIDImpl(
SrcMgr::ContentCache& File,
llvm::StringRef Filename,
clang::SourceLocation IncludePos,
SrcMgr::CharacteristicKind DirCharacter,
int LoadedID,
SourceLocation::UIntTy LoadedOffset)
Description
Create a new fileID for the specified ContentCache and include position. This works regardless of whether the ContentCache corresponds to a file or some other input source.
Declared at: clang/include/clang/Basic/SourceManager.h:1858
Parameters
- SrcMgr::ContentCache& File
- llvm::StringRef Filename
- clang::SourceLocation IncludePos
- SrcMgr::CharacteristicKind DirCharacter
- int LoadedID
- SourceLocation::UIntTy LoadedOffset
¶clang::SourceLocation createMacroArgExpansionLoc(
clang::SourceLocation SpellingLoc,
clang::SourceLocation ExpansionLoc,
unsigned int Length)
clang::SourceLocation createMacroArgExpansionLoc(
clang::SourceLocation SpellingLoc,
clang::SourceLocation ExpansionLoc,
unsigned int Length)
Description
Creates an expansion SLocEntry for the substitution of an argument into a function-like macro's body. Returns the start of the expansion. The macro argument was written at \p SpellingLoc with length \p Length. \p ExpansionLoc is the parameter name in the (expanded) macro body.
Declared at: clang/include/clang/Basic/SourceManager.h:908
Parameters
- clang::SourceLocation SpellingLoc
- clang::SourceLocation ExpansionLoc
- unsigned int Length
¶SrcMgr::ContentCache& createMemBufferContentCache(
std::unique_ptr<llvm::MemoryBuffer> Buf)
SrcMgr::ContentCache& createMemBufferContentCache(
std::unique_ptr<llvm::MemoryBuffer> Buf)
Description
Create a new ContentCache for the specified memory buffer.
Declared at: clang/include/clang/Basic/SourceManager.h:1868
Parameters
- std::unique_ptr<llvm::MemoryBuffer> Buf
¶clang::SourceLocation createTokenSplitLoc(
clang::SourceLocation SpellingLoc,
clang::SourceLocation TokenStart,
clang::SourceLocation TokenEnd)
clang::SourceLocation createTokenSplitLoc(
clang::SourceLocation SpellingLoc,
clang::SourceLocation TokenStart,
clang::SourceLocation TokenEnd)
Description
Return a new SourceLocation that encodes that the token starting at \p TokenStart ends prematurely at \p TokenEnd.
Declared at: clang/include/clang/Basic/SourceManager.h:926
Parameters
- clang::SourceLocation SpellingLoc
- clang::SourceLocation TokenStart
- clang::SourceLocation TokenEnd
¶void dump() const
void dump() const
Declared at: clang/include/clang/Basic/SourceManager.h:1690
¶clang::SourceManager::fileinfo_iterator
fileinfo_begin() const
clang::SourceManager::fileinfo_iterator
fileinfo_begin() const
Declared at: clang/include/clang/Basic/SourceManager.h:1681
¶clang::SourceManager::fileinfo_iterator
fileinfo_end() const
clang::SourceManager::fileinfo_iterator
fileinfo_end() const
Declared at: clang/include/clang/Basic/SourceManager.h:1682
¶llvm::StringRef getBufferData(
clang::FileID FID,
bool* Invalid = nullptr) const
llvm::StringRef getBufferData(
clang::FileID FID,
bool* Invalid = nullptr) const
Description
Return a StringRef to the source buffer data for the specified FileID.
Declared at: clang/include/clang/Basic/SourceManager.h:1065
Parameters
- clang::FileID FID
- The file ID whose contents will be returned.
- bool* Invalid = nullptr
- If non-NULL, will be set true if an error occurred.
¶llvm::Optional<StringRef> getBufferDataIfLoaded(
clang::FileID FID) const
llvm::Optional<StringRef> getBufferDataIfLoaded(
clang::FileID FID) const
Description
Return a StringRef to the source buffer data for the specified FileID, returning None if it's not yet loaded.
Declared at: clang/include/clang/Basic/SourceManager.h:1077
Parameters
- clang::FileID FID
- The file ID whose contents will be returned.
¶llvm::Optional<StringRef> getBufferDataOrNone(
clang::FileID FID) const
llvm::Optional<StringRef> getBufferDataOrNone(
clang::FileID FID) const
Description
Return a StringRef to the source buffer data for the specified FileID, returning None if invalid.
Declared at: clang/include/clang/Basic/SourceManager.h:1071
Parameters
- clang::FileID FID
- The file ID whose contents will be returned.
¶llvm::StringRef getBufferName(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
llvm::StringRef getBufferName(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Description
Return the filename or buffer identifier of the buffer the location is in. Note that this name does not respect # line directives. Use getPresumedLoc for normal clients.
Declared at: clang/include/clang/Basic/SourceManager.h:1419
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶llvm::MemoryBufferRef getBufferOrFake(
clang::FileID FID,
clang::SourceLocation Loc =
clang::SourceLocation()) const
llvm::MemoryBufferRef getBufferOrFake(
clang::FileID FID,
clang::SourceLocation Loc =
clang::SourceLocation()) const
Description
Return the buffer for the specified FileID. If there is an error opening this buffer the first time, this manufactures a temporary buffer and returns it.
Declared at: clang/include/clang/Basic/SourceManager.h:1028
Parameters
- clang::FileID FID
- clang::SourceLocation Loc = clang::SourceLocation()
¶llvm::Optional<llvm::MemoryBufferRef>
getBufferOrNone(clang::FileID FID,
clang::SourceLocation Loc =
clang::SourceLocation()) const
llvm::Optional<llvm::MemoryBufferRef>
getBufferOrNone(clang::FileID FID,
clang::SourceLocation Loc =
clang::SourceLocation()) const
Description
Return the buffer for the specified FileID. If there is an error opening this buffer the first time, return None.
Declared at: clang/include/clang/Basic/SourceManager.h:1016
Parameters
- clang::FileID FID
- clang::SourceLocation Loc = clang::SourceLocation()
¶const char* getCharacterData(
clang::SourceLocation SL,
bool* Invalid = nullptr) const
const char* getCharacterData(
clang::SourceLocation SL,
bool* Invalid = nullptr) const
Description
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer.
Declared at: clang/include/clang/Basic/SourceManager.h:1385
Parameters
- clang::SourceLocation SL
- bool* Invalid = nullptr
- If non-NULL, will be set \c true if an error occurs.
¶unsigned int getColumnNumber(
clang::FileID FID,
unsigned int FilePos,
bool* Invalid = nullptr) const
unsigned int getColumnNumber(
clang::FileID FID,
unsigned int FilePos,
bool* Invalid = nullptr) const
Description
Return the column # for the specified file position. This is significantly cheaper to compute than the line number. This returns zero if the column number isn't known. This may only be called on a file sloc, so you must choose a spelling or expansion location before calling this method.
Declared at: clang/include/clang/Basic/SourceManager.h:1394
Parameters
- clang::FileID FID
- unsigned int FilePos
- bool* Invalid = nullptr
¶clang::SourceLocation getComposedLoc(
clang::FileID FID,
unsigned int Offset) const
clang::SourceLocation getComposedLoc(
clang::FileID FID,
unsigned int Offset) const
Description
Form a SourceLocation from a FileID and Offset pair.
Declared at: clang/include/clang/Basic/SourceManager.h:1227
Parameters
- clang::FileID FID
- unsigned int Offset
¶size_t getContentCacheSize() const
size_t getContentCacheSize() const
Description
Return the total amount of physical memory allocated by the ContentCache allocator.
Declared at: clang/include/clang/Basic/SourceManager.h:1576
¶size_t getDataStructureSizes() const
size_t getDataStructureSizes() const
Description
Return the amount of memory used for various side tables and data structures in the SourceManager.
Declared at: clang/include/clang/Basic/SourceManager.h:1594
¶std::pair<FileID, unsigned int>
getDecomposedExpansionLoc(
clang::SourceLocation Loc) const
std::pair<FileID, unsigned int>
getDecomposedExpansionLoc(
clang::SourceLocation Loc) const
Description
Decompose the specified location into a raw FileID + Offset pair. If the location is an expansion record, walk through it until we find the final location expanded.
Declared at: clang/include/clang/Basic/SourceManager.h:1254
Parameters
¶std::pair<FileID, unsigned int>
getDecomposedExpansionLocSlowCase(
const SrcMgr::SLocEntry* E) const
std::pair<FileID, unsigned int>
getDecomposedExpansionLocSlowCase(
const SrcMgr::SLocEntry* E) const
Declared at: clang/include/clang/Basic/SourceManager.h:1879
Parameters
- const SrcMgr::SLocEntry* E
¶std::pair<FileID, unsigned int>
getDecomposedIncludedLoc(clang::FileID FID) const
std::pair<FileID, unsigned int>
getDecomposedIncludedLoc(clang::FileID FID) const
Description
Returns the "included/expanded in" decomposed location of the given FileID.
Declared at: clang/include/clang/Basic/SourceManager.h:1286
Parameters
- clang::FileID FID
¶std::pair<FileID, unsigned int> getDecomposedLoc(
clang::SourceLocation Loc) const
std::pair<FileID, unsigned int> getDecomposedLoc(
clang::SourceLocation Loc) const
Description
Decompose the specified location into a raw FileID + Offset pair. The first element is the FileID, the second is the offset from the start of the buffer of the location.
Declared at: clang/include/clang/Basic/SourceManager.h:1241
Parameters
¶std::pair<FileID, unsigned int>
getDecomposedSpellingLoc(
clang::SourceLocation Loc) const
std::pair<FileID, unsigned int>
getDecomposedSpellingLoc(
clang::SourceLocation Loc) const
Description
Decompose the specified location into a raw FileID + Offset pair. If the location is an expansion record, walk through it until we find its spelling record.
Declared at: clang/include/clang/Basic/SourceManager.h:1272
Parameters
¶std::pair<FileID, unsigned int>
getDecomposedSpellingLocSlowCase(
const SrcMgr::SLocEntry* E,
unsigned int Offset) const
std::pair<FileID, unsigned int>
getDecomposedSpellingLocSlowCase(
const SrcMgr::SLocEntry* E,
unsigned int Offset) const
Declared at: clang/include/clang/Basic/SourceManager.h:1881
Parameters
- const SrcMgr::SLocEntry* E
- unsigned int Offset
¶clang::DiagnosticsEngine& getDiagnostics() const
clang::DiagnosticsEngine& getDiagnostics() const
Declared at: clang/include/clang/Basic/SourceManager.h:805
¶unsigned int getExpansionColumnNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
unsigned int getExpansionColumnNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1398
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶unsigned int getExpansionLineNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
unsigned int getExpansionLineNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1411
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶clang::SourceLocation getExpansionLoc(
clang::SourceLocation Loc) const
clang::SourceLocation getExpansionLoc(
clang::SourceLocation Loc) const
Description
Given a SourceLocation object \p Loc, return the expansion location referenced by the ID.
Declared at: clang/include/clang/Basic/SourceManager.h:1163
Parameters
¶clang::SourceLocation getExpansionLocSlowCase(
clang::SourceLocation Loc) const
clang::SourceLocation getExpansionLocSlowCase(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Basic/SourceManager.h:1874
Parameters
¶clang::CharSourceRange getExpansionRange(
clang::CharSourceRange Range) const
clang::CharSourceRange getExpansionRange(
clang::CharSourceRange Range) const
Description
Given a CharSourceRange object, return the range of tokens or characters covered by the expansion in the ultimate file.
Declared at: clang/include/clang/Basic/SourceManager.h:1199
Parameters
- clang::CharSourceRange Range
¶clang::CharSourceRange getExpansionRange(
clang::SourceRange Range) const
clang::CharSourceRange getExpansionRange(
clang::SourceRange Range) const
Description
Given a SourceRange object, return the range of tokens or characters covered by the expansion in the ultimate file.
Declared at: clang/include/clang/Basic/SourceManager.h:1190
Parameters
- clang::SourceRange Range
¶clang::CharSourceRange getExpansionRange(
clang::SourceLocation Loc) const
clang::CharSourceRange getExpansionRange(
clang::SourceLocation Loc) const
Description
Given a SourceLocation object, return the range of tokens covered by the expansion in the ultimate file.
Declared at: clang/include/clang/Basic/SourceManager.h:1186
Parameters
¶llvm::MemoryBufferRef getFakeBufferForRecovery()
const
llvm::MemoryBufferRef getFakeBufferForRecovery()
const
Declared at: clang/include/clang/Basic/SourceManager.h:1784
¶SrcMgr::ContentCache&
getFakeContentCacheForRecovery() const
SrcMgr::ContentCache&
getFakeContentCacheForRecovery() const
Declared at: clang/include/clang/Basic/SourceManager.h:1785
¶SrcMgr::CharacteristicKind getFileCharacteristic(
clang::SourceLocation Loc) const
SrcMgr::CharacteristicKind getFileCharacteristic(
clang::SourceLocation Loc) const
Description
Return the file characteristic of the specified source location, indicating whether this is a normal file, a system header, or an "implicit extern C" system header. This state can be modified with flags on GNU linemarker directives like: which changes all source locations in the current file after that to be considered to be from a system header.
Declared at: clang/include/clang/Basic/SourceManager.h:1431
Parameters
¶const clang::FileEntry* getFileEntryForID(
clang::FileID FID) const
const clang::FileEntry* getFileEntryForID(
clang::FileID FID) const
Description
Returns the FileEntry record for the provided FileID.
Declared at: clang/include/clang/Basic/SourceManager.h:1035
Parameters
- clang::FileID FID
¶const clang::FileEntry* getFileEntryForSLocEntry(
const SrcMgr::SLocEntry& sloc) const
const clang::FileEntry* getFileEntryForSLocEntry(
const SrcMgr::SLocEntry& sloc) const
Description
Returns the FileEntry record for the provided SLocEntry.
Declared at: clang/include/clang/Basic/SourceManager.h:1055
Parameters
- const SrcMgr::SLocEntry& sloc
¶Optional<clang::FileEntryRef>
getFileEntryRefForID(clang::FileID FID) const
Optional<clang::FileEntryRef>
getFileEntryRefForID(clang::FileID FID) const
Description
Returns the FileEntryRef for the provided FileID.
Declared at: clang/include/clang/Basic/SourceManager.h:1042
Parameters
- clang::FileID FID
¶clang::FileID getFileID(
clang::SourceLocation SpellingLoc) const
clang::FileID getFileID(
clang::SourceLocation SpellingLoc) const
Description
Return the FileID for a SourceLocation. This is a very hot method that is used for all SourceManager queries that start with a SourceLocation object. It is responsible for finding the entry in SLocEntryTable which contains the specified location.
Declared at: clang/include/clang/Basic/SourceManager.h:1108
Parameters
- clang::SourceLocation SpellingLoc
¶clang::FileID getFileIDLoaded(
SourceLocation::UIntTy SLocOffset) const
clang::FileID getFileIDLoaded(
SourceLocation::UIntTy SLocOffset) const
Declared at: clang/include/clang/Basic/SourceManager.h:1872
Parameters
- SourceLocation::UIntTy SLocOffset
¶clang::FileID getFileIDLocal(
SourceLocation::UIntTy SLocOffset) const
clang::FileID getFileIDLocal(
SourceLocation::UIntTy SLocOffset) const
Declared at: clang/include/clang/Basic/SourceManager.h:1871
Parameters
- SourceLocation::UIntTy SLocOffset
¶unsigned int getFileIDSize(
clang::FileID FID) const
unsigned int getFileIDSize(
clang::FileID FID) const
Description
The size of the SLocEntry that \p FID represents.
Declared at: clang/include/clang/Basic/SourceManager.h:1532
Parameters
- clang::FileID FID
¶clang::FileID getFileIDSlow(
SourceLocation::UIntTy SLocOffset) const
clang::FileID getFileIDSlow(
SourceLocation::UIntTy SLocOffset) const
Declared at: clang/include/clang/Basic/SourceManager.h:1870
Parameters
- SourceLocation::UIntTy SLocOffset
¶clang::SourceLocation getFileLoc(
clang::SourceLocation Loc) const
clang::SourceLocation getFileLoc(
clang::SourceLocation Loc) const
Description
Given \p Loc, if it is a macro location return the expansion location or the spelling location, depending on if it comes from a macro argument or not.
Declared at: clang/include/clang/Basic/SourceManager.h:1173
Parameters
¶clang::SourceLocation getFileLocSlowCase(
clang::SourceLocation Loc) const
clang::SourceLocation getFileLocSlowCase(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Basic/SourceManager.h:1876
Parameters
¶clang::FileManager& getFileManager() const
clang::FileManager& getFileManager() const
Declared at: clang/include/clang/Basic/SourceManager.h:807
¶unsigned int getFileOffset(
clang::SourceLocation SpellingLoc) const
unsigned int getFileOffset(
clang::SourceLocation SpellingLoc) const
Description
Returns the offset from the start of the file that the specified SourceLocation represents. This is not very meaningful for a macro ID.
Declared at: clang/include/clang/Basic/SourceManager.h:1292
Parameters
- clang::SourceLocation SpellingLoc
¶llvm::StringRef getFilename(
clang::SourceLocation SpellingLoc) const
llvm::StringRef getFilename(
clang::SourceLocation SpellingLoc) const
Description
Return the filename of the file containing a SourceLocation.
Declared at: clang/include/clang/Basic/SourceManager.h:1119
Parameters
- clang::SourceLocation SpellingLoc
¶clang::CharSourceRange getImmediateExpansionRange(
clang::SourceLocation Loc) const
clang::CharSourceRange getImmediateExpansionRange(
clang::SourceLocation Loc) const
Description
Return the start/end of the expansion information for an expansion location.
Declared at: clang/include/clang/Basic/SourceManager.h:1182
Parameters
¶clang::SourceLocation getImmediateMacroCallerLoc(
clang::SourceLocation Loc) const
clang::SourceLocation getImmediateMacroCallerLoc(
clang::SourceLocation Loc) const
Description
Gets the location of the immediate macro caller, one level up the stack toward the initial macro typed into the source.
Declared at: clang/include/clang/Basic/SourceManager.h:1763
Parameters
¶clang::SourceLocation getImmediateSpellingLoc(
clang::SourceLocation Loc) const
clang::SourceLocation getImmediateSpellingLoc(
clang::SourceLocation Loc) const
Description
Given a SourceLocation object, return the spelling location referenced by the ID. This is the first level down towards the place where the characters that make up the lexed token can be found. This should not generally be used by clients.
Declared at: clang/include/clang/Basic/SourceManager.h:1224
Parameters
¶clang::InBeforeInTUCacheEntry&
getInBeforeInTUCache(clang::FileID LFID,
clang::FileID RFID) const
clang::InBeforeInTUCacheEntry&
getInBeforeInTUCache(clang::FileID LFID,
clang::FileID RFID) const
Description
Return the cache entry for comparing the given file IDs for isBeforeInTranslationUnit.
Declared at: clang/include/clang/Basic/SourceManager.h:767
Parameters
- clang::FileID LFID
- clang::FileID RFID
¶clang::SourceLocation getIncludeLoc(
clang::FileID FID) const
clang::SourceLocation getIncludeLoc(
clang::FileID FID) const
Description
Returns the include location if \p FID is a # include'd file otherwise it returns an invalid location.
Declared at: clang/include/clang/Basic/SourceManager.h:1140
Parameters
- clang::FileID FID
¶unsigned int getLineNumber(
clang::FileID FID,
unsigned int FilePos,
bool* Invalid = nullptr) const
unsigned int getLineNumber(
clang::FileID FID,
unsigned int FilePos,
bool* Invalid = nullptr) const
Description
Given a SourceLocation, return the spelling line number for the position indicated. This requires building and caching a table of line offsets for the MemoryBuffer, so this is not cheap: use only when about to emit a diagnostic.
Declared at: clang/include/clang/Basic/SourceManager.h:1409
Parameters
- clang::FileID FID
- unsigned int FilePos
- bool* Invalid = nullptr
¶clang::LineTableInfo& getLineTable()
clang::LineTableInfo& getLineTable()
Description
Retrieve the stored line table.
Declared at: clang/include/clang/Basic/SourceManager.h:1568
¶unsigned int getLineTableFilenameID(
llvm::StringRef Str)
unsigned int getLineTableFilenameID(
llvm::StringRef Str)
Description
Return the uniqued ID for the specified filename.
Declared at: clang/include/clang/Basic/SourceManager.h:1554
Parameters
- llvm::StringRef Str
¶const SrcMgr::SLocEntry& getLoadedSLocEntry(
unsigned int Index,
bool* Invalid = nullptr) const
const SrcMgr::SLocEntry& getLoadedSLocEntry(
unsigned int Index,
bool* Invalid = nullptr) const
Description
Get a loaded SLocEntry. This is exposed for indexing.
Declared at: clang/include/clang/Basic/SourceManager.h:1705
Parameters
- unsigned int Index
- bool* Invalid = nullptr
¶const SrcMgr::SLocEntry& getLoadedSLocEntryByID(
int ID,
bool* Invalid = nullptr) const
const SrcMgr::SLocEntry& getLoadedSLocEntryByID(
int ID,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1813
Parameters
- int ID
- bool* Invalid = nullptr
¶clang::SourceLocation getLocForEndOfFile(
clang::FileID FID) const
clang::SourceLocation getLocForEndOfFile(
clang::FileID FID) const
Description
Return the source location corresponding to the last byte of the specified file.
Declared at: clang/include/clang/Basic/SourceManager.h:1131
Parameters
- clang::FileID FID
¶clang::SourceLocation getLocForStartOfFile(
clang::FileID FID) const
clang::SourceLocation getLocForStartOfFile(
clang::FileID FID) const
Description
Return the source location corresponding to the first byte of the specified file.
Declared at: clang/include/clang/Basic/SourceManager.h:1123
Parameters
- clang::FileID FID
¶const SrcMgr::SLocEntry& getLocalSLocEntry(
unsigned int Index) const
const SrcMgr::SLocEntry& getLocalSLocEntry(
unsigned int Index) const
Description
Get a local SLocEntry. This is exposed for indexing.
Declared at: clang/include/clang/Basic/SourceManager.h:1696
Parameters
- unsigned int Index
¶clang::SourceLocation getMacroArgExpandedLocation(
clang::SourceLocation Loc) const
clang::SourceLocation getMacroArgExpandedLocation(
clang::SourceLocation Loc) const
Description
If \p Loc points inside a function macro argument, the returned location will be the macro location in which the argument was expanded. If a macro argument is used multiple times, the expanded location will be at the first expansion of the argument. e.g. MY_MACRO(foo); ^ Passing a file location pointing at 'foo', will yield a macro location where 'foo' was expanded into.
Declared at: clang/include/clang/Basic/SourceManager.h:1630
Parameters
¶clang::FileID getMainFileID() const
clang::FileID getMainFileID() const
Description
Returns the FileID of the main source file.
Declared at: clang/include/clang/Basic/SourceManager.h:841
¶llvm::MemoryBufferRef
getMemoryBufferForFileOrFake(
const clang::FileEntry* File)
llvm::MemoryBufferRef
getMemoryBufferForFileOrFake(
const clang::FileEntry* File)
Description
Retrieve the memory buffer associated with the given file. Returns a fake buffer if there isn't a real one.
Declared at: clang/include/clang/Basic/SourceManager.h:939
Parameters
- const clang::FileEntry* File
¶llvm::Optional<llvm::MemoryBufferRef>
getMemoryBufferForFileOrNone(
const clang::FileEntry* File)
llvm::Optional<llvm::MemoryBufferRef>
getMemoryBufferForFileOrNone(
const clang::FileEntry* File)
Description
Retrieve the memory buffer associated with the given file. Returns None if the buffer is not valid.
Declared at: clang/include/clang/Basic/SourceManager.h:934
Parameters
- const clang::FileEntry* File
¶clang::SourceManager::MemoryBufferSizes
getMemoryBufferSizes() const
clang::SourceManager::MemoryBufferSizes
getMemoryBufferSizes() const
Description
Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.
Declared at: clang/include/clang/Basic/SourceManager.h:1590
¶clang::ModuleBuildStack getModuleBuildStack()
const
clang::ModuleBuildStack getModuleBuildStack()
const
Description
Retrieve the module build stack.
Declared at: clang/include/clang/Basic/SourceManager.h:821
¶std::pair<SourceLocation, StringRef>
getModuleImportLoc(
clang::SourceLocation Loc) const
std::pair<SourceLocation, StringRef>
getModuleImportLoc(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Basic/SourceManager.h:1150
Parameters
¶clang::FileID getNextFileID(
clang::FileID FID) const
clang::FileID getNextFileID(
clang::FileID FID) const
Description
Returns the next in-order FileID or an invalid FileID if there is no next one.
Declared at: clang/include/clang/Basic/SourceManager.h:1851
Parameters
- clang::FileID FID
¶SourceLocation::UIntTy getNextLocalOffset() const
SourceLocation::UIntTy getNextLocalOffset() const
Declared at: clang/include/clang/Basic/SourceManager.h:1722
¶Optional<llvm::StringRef>
getNonBuiltinFilenameForID(
clang::FileID FID) const
Optional<llvm::StringRef>
getNonBuiltinFilenameForID(
clang::FileID FID) const
Description
Returns the filename for the provided FileID, unless it's a built-in buffer that's not represented by a filename. Returns None for non-files and built-in files.
Declared at: clang/include/clang/Basic/SourceManager.h:1052
Parameters
- clang::FileID FID
¶unsigned int getNumCreatedFIDsForFileID(
clang::FileID FID) const
unsigned int getNumCreatedFIDsForFileID(
clang::FileID FID) const
Description
Get the number of FileIDs (files and macros) that were created during preprocessing of \p FID, including it.
Declared at: clang/include/clang/Basic/SourceManager.h:1081
Parameters
- clang::FileID FID
¶SrcMgr::ContentCache& getOrCreateContentCache(
clang::FileEntryRef SourceFile,
bool isSystemFile = false)
SrcMgr::ContentCache& getOrCreateContentCache(
clang::FileEntryRef SourceFile,
bool isSystemFile = false)
Declared at: clang/include/clang/Basic/SourceManager.h:1863
Parameters
- clang::FileEntryRef SourceFile
- bool isSystemFile = false
¶clang::FileID getOrCreateFileID(
const clang::FileEntry* SourceFile,
SrcMgr::CharacteristicKind FileCharacter)
clang::FileID getOrCreateFileID(
const clang::FileEntry* SourceFile,
SrcMgr::CharacteristicKind FileCharacter)
Description
Get the FileID for \p SourceFile if it exists. Otherwise, create a new FileID for the \p SourceFile.
Declared at: clang/include/clang/Basic/SourceManager.h:900
Parameters
- const clang::FileEntry* SourceFile
- SrcMgr::CharacteristicKind FileCharacter
¶clang::SourceManager::OverriddenFilesInfoTy&
getOverriddenFilesInfo()
clang::SourceManager::OverriddenFilesInfoTy&
getOverriddenFilesInfo()
Declared at: clang/include/clang/Basic/SourceManager.h:669
¶clang::FileID getPreambleFileID() const
clang::FileID getPreambleFileID() const
Description
Get the file ID for the precompiled preamble if there is one.
Declared at: clang/include/clang/Basic/SourceManager.h:860
¶unsigned int getPresumedColumnNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
unsigned int getPresumedColumnNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1400
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶unsigned int getPresumedLineNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
unsigned int getPresumedLineNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1412
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶clang::PresumedLoc getPresumedLoc(
clang::SourceLocation Loc,
bool UseLineDirectives = true) const
clang::PresumedLoc getPresumedLoc(
clang::SourceLocation Loc,
bool UseLineDirectives = true) const
Description
Returns the "presumed" location of a SourceLocation specifies. A "presumed location" can be modified by # line or GNU line marker directives. This provides a view on the data that a user should see in diagnostics, for example. Note that a presumed location is always given as the expansion point of an expansion location, not at the spelling location.
Declared at: clang/include/clang/Basic/SourceManager.h:1446
Parameters
- clang::SourceLocation Loc
- bool UseLineDirectives = true
Returns
The presumed location of the specified SourceLocation. If the presumed location cannot be calculated (e.g., because \p Loc is invalid or the file containing \p Loc has changed on disk), returns an invalid presumed location.
¶clang::FileID getPreviousFileID(
clang::FileID FID) const
clang::FileID getPreviousFileID(
clang::FileID FID) const
Description
Returns the previous in-order FileID or an invalid FileID if there is no previous one.
Declared at: clang/include/clang/Basic/SourceManager.h:1847
Parameters
- clang::FileID FID
¶const SrcMgr::SLocEntry& getSLocEntry(
clang::FileID FID,
bool* Invalid = nullptr) const
const SrcMgr::SLocEntry& getSLocEntry(
clang::FileID FID,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1713
Parameters
- clang::FileID FID
- bool* Invalid = nullptr
¶const SrcMgr::SLocEntry& getSLocEntryByID(
int ID,
bool* Invalid = nullptr) const
const SrcMgr::SLocEntry& getSLocEntryByID(
int ID,
bool* Invalid = nullptr) const
Description
Get the entry with the given unwrapped FileID. Invalid will not be modified for Local IDs.
Declared at: clang/include/clang/Basic/SourceManager.h:1804
Parameters
- int ID
- bool* Invalid = nullptr
¶const SrcMgr::SLocEntry* getSLocEntryForFile(
clang::FileID FID) const
const SrcMgr::SLocEntry* getSLocEntryForFile(
clang::FileID FID) const
Declared at: clang/include/clang/Basic/SourceManager.h:1795
Parameters
- clang::FileID FID
¶const SrcMgr::SLocEntry* getSLocEntryOrNull(
clang::FileID FID) const
const SrcMgr::SLocEntry* getSLocEntryOrNull(
clang::FileID FID) const
Declared at: clang/include/clang/Basic/SourceManager.h:1789
Parameters
- clang::FileID FID
¶unsigned int getSpellingColumnNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
unsigned int getSpellingColumnNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1396
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶unsigned int getSpellingLineNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
unsigned int getSpellingLineNumber(
clang::SourceLocation Loc,
bool* Invalid = nullptr) const
Declared at: clang/include/clang/Basic/SourceManager.h:1410
Parameters
- clang::SourceLocation Loc
- bool* Invalid = nullptr
¶clang::SourceLocation getSpellingLoc(
clang::SourceLocation Loc) const
clang::SourceLocation getSpellingLoc(
clang::SourceLocation Loc) const
Description
Given a SourceLocation object, return the spelling location referenced by the ID. This is the place where the characters that make up the lexed token can be found.
Declared at: clang/include/clang/Basic/SourceManager.h:1211
Parameters
¶clang::SourceLocation getSpellingLocSlowCase(
clang::SourceLocation Loc) const
clang::SourceLocation getSpellingLocSlowCase(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Basic/SourceManager.h:1875
Parameters
¶clang::SourceLocation getTopMacroCallerLoc(
clang::SourceLocation Loc) const
clang::SourceLocation getTopMacroCallerLoc(
clang::SourceLocation Loc) const
Declared at: clang/include/clang/Basic/SourceManager.h:1778
Parameters
Returns
Location of the top-level macro caller.
¶bool hasFileInfo(
const clang::FileEntry* File) const
bool hasFileInfo(
const clang::FileEntry* File) const
Declared at: clang/include/clang/Basic/SourceManager.h:1683
Parameters
- const clang::FileEntry* File
¶bool hasLineTable() const
bool hasLineTable() const
Description
Determine if the source manager has a line table.
Declared at: clang/include/clang/Basic/SourceManager.h:1565
¶void initializeForReplay(
const clang::SourceManager& Old)
void initializeForReplay(
const clang::SourceManager& Old)
Description
Initialize this source manager suitably to replay the compilation described by \p Old. Requires that \p Old outlive \p *this.
Declared at: clang/include/clang/Basic/SourceManager.h:803
Parameters
- const clang::SourceManager& Old
¶bool isAtEndOfImmediateMacroExpansion(
clang::SourceLocation Loc,
clang::SourceLocation* MacroEnd =
nullptr) const
bool isAtEndOfImmediateMacroExpansion(
clang::SourceLocation Loc,
clang::SourceLocation* MacroEnd =
nullptr) const
Description
Returns true if the given MacroID location points at the character end of the immediate macro expansion.
Declared at: clang/include/clang/Basic/SourceManager.h:1329
Parameters
- clang::SourceLocation Loc
- clang::SourceLocation* MacroEnd = nullptr
- If non-null and function returns true, it is set to the character end location of the immediate macro expansion.
¶bool isAtStartOfImmediateMacroExpansion(
clang::SourceLocation Loc,
clang::SourceLocation* MacroBegin =
nullptr) const
bool isAtStartOfImmediateMacroExpansion(
clang::SourceLocation Loc,
clang::SourceLocation* MacroBegin =
nullptr) const
Description
Returns true if the given MacroID location points at the beginning of the immediate macro expansion.
Declared at: clang/include/clang/Basic/SourceManager.h:1320
Parameters
- clang::SourceLocation Loc
- clang::SourceLocation* MacroBegin = nullptr
- If non-null and function returns true, it is set to the begin location of the immediate macro expansion.
¶bool isBeforeInSLocAddrSpace(
clang::SourceLocation LHS,
SourceLocation::UIntTy RHS) const
bool isBeforeInSLocAddrSpace(
clang::SourceLocation LHS,
SourceLocation::UIntTy RHS) const
Description
Determines the order of a source location and a source location offset in the "source location address space". Note that we always consider source locations loaded from
Declared at: clang/include/clang/Basic/SourceManager.h:1658
Parameters
- clang::SourceLocation LHS
- SourceLocation::UIntTy RHS
¶bool isBeforeInSLocAddrSpace(
clang::SourceLocation LHS,
clang::SourceLocation RHS) const
bool isBeforeInSLocAddrSpace(
clang::SourceLocation LHS,
clang::SourceLocation RHS) const
Description
Determines the order of 2 source locations in the "source location address space".
Declared at: clang/include/clang/Basic/SourceManager.h:1650
Parameters
¶bool isBeforeInTranslationUnit(
clang::SourceLocation LHS,
clang::SourceLocation RHS) const
bool isBeforeInTranslationUnit(
clang::SourceLocation LHS,
clang::SourceLocation RHS) const
Description
Determines the order of 2 source locations in the translation unit.
Declared at: clang/include/clang/Basic/SourceManager.h:1635
Parameters
Returns
true if LHS source location comes before RHS, false otherwise.
¶bool isFileOverridden(
const clang::FileEntry* File) const
bool isFileOverridden(
const clang::FileEntry* File) const
Description
Returns true if the file contents have been overridden.
Declared at: clang/include/clang/Basic/SourceManager.h:981
Parameters
- const clang::FileEntry* File
¶bool isInExternCSystemHeader(
clang::SourceLocation Loc) const
bool isInExternCSystemHeader(
clang::SourceLocation Loc) const
Description
Returns if a SourceLocation is in an "extern C" system header.
Declared at: clang/include/clang/Basic/SourceManager.h:1509
Parameters
¶bool isInFileID(
clang::SourceLocation Loc,
clang::FileID FID,
unsigned int* RelativeOffset = nullptr) const
bool isInFileID(
clang::SourceLocation Loc,
clang::FileID FID,
unsigned int* RelativeOffset = nullptr) const
Description
Given a specific FileID, returns true if \p Loc is inside that FileID chunk and sets relative offset (offset of \p Loc from beginning of FileID) to \p relativeOffset.
Declared at: clang/include/clang/Basic/SourceManager.h:1537
Parameters
- clang::SourceLocation Loc
- clang::FileID FID
- unsigned int* RelativeOffset = nullptr
¶bool isInMainFile(clang::SourceLocation Loc) const
bool isInMainFile(clang::SourceLocation Loc) const
Description
Returns whether the PresumedLoc for a given SourceLocation is in the main file. This computes the "presumed" location for a SourceLocation, then checks whether it came from a file other than the main file. This is different from isWrittenInMainFile() because it takes line marker directives into account.
Declared at: clang/include/clang/Basic/SourceManager.h:1456
Parameters
¶bool isInSLocAddrSpace(
clang::SourceLocation Loc,
clang::SourceLocation Start,
unsigned int Length,
SourceLocation::UIntTy* RelativeOffset =
nullptr) const
bool isInSLocAddrSpace(
clang::SourceLocation Loc,
clang::SourceLocation Start,
unsigned int Length,
SourceLocation::UIntTy* RelativeOffset =
nullptr) const
Description
Returns true if \p Loc is inside the [\p Start, +\p Length) chunk of the source location address space. If it's true and \p RelativeOffset is non-null, it will be set to the relative offset of \p Loc inside the chunk.
Declared at: clang/include/clang/Basic/SourceManager.h:1338
Parameters
- clang::SourceLocation Loc
- clang::SourceLocation Start
- unsigned int Length
- SourceLocation::UIntTy* RelativeOffset = nullptr
¶bool isInSameSLocAddrSpace(
clang::SourceLocation LHS,
clang::SourceLocation RHS,
SourceLocation::IntTy* RelativeOffset) const
bool isInSameSLocAddrSpace(
clang::SourceLocation LHS,
clang::SourceLocation RHS,
SourceLocation::IntTy* RelativeOffset) const
Description
Return true if both \p LHS and \p RHS are in the local source location address space or the loaded one. If it's true and \p RelativeOffset is non-null, it will be set to the offset of \p RHS relative to \p LHS.
Declared at: clang/include/clang/Basic/SourceManager.h:1362
Parameters
- clang::SourceLocation LHS
- clang::SourceLocation RHS
- SourceLocation::IntTy* RelativeOffset
¶bool isInSystemHeader(
clang::SourceLocation Loc) const
bool isInSystemHeader(
clang::SourceLocation Loc) const
Description
Returns if a SourceLocation is in a system header.
Declared at: clang/include/clang/Basic/SourceManager.h:1502
Parameters
¶bool isInSystemMacro(
clang::SourceLocation loc) const
bool isInSystemMacro(
clang::SourceLocation loc) const
Description
Returns whether \p Loc is expanded from a macro in a system header.
Declared at: clang/include/clang/Basic/SourceManager.h:1514
Parameters
¶std::pair<bool, bool> isInTheSameTranslationUnit(
std::pair<FileID, unsigned int>& LOffs,
std::pair<FileID, unsigned int>& ROffs) const
std::pair<bool, bool> isInTheSameTranslationUnit(
std::pair<FileID, unsigned int>& LOffs,
std::pair<FileID, unsigned int>& ROffs) const
Description
Determines whether the two decomposed source location is in the same translation unit. As a byproduct, it also calculates the order of the source locations in case they are in the same TU.
Declared at: clang/include/clang/Basic/SourceManager.h:1645
Parameters
Returns
Pair of bools the first component is true if the two locations are in the same TU. The second bool is true if the first is true and \p LOffs is before \p ROffs.
¶bool isLoadedFileID(clang::FileID FID) const
bool isLoadedFileID(clang::FileID FID) const
Description
Returns true if \p FID came from a PCH/Module.
Declared at: clang/include/clang/Basic/SourceManager.h:1751
Parameters
- clang::FileID FID
¶bool isLoadedSourceLocation(
clang::SourceLocation Loc) const
bool isLoadedSourceLocation(
clang::SourceLocation Loc) const
Description
Returns true if \p Loc came from a PCH/Module.
Declared at: clang/include/clang/Basic/SourceManager.h:1741
Parameters
¶bool isLocalFileID(clang::FileID FID) const
bool isLocalFileID(clang::FileID FID) const
Description
Returns true if \p FID did not come from a PCH/Module.
Declared at: clang/include/clang/Basic/SourceManager.h:1757
Parameters
- clang::FileID FID
¶bool isLocalSourceLocation(
clang::SourceLocation Loc) const
bool isLocalSourceLocation(
clang::SourceLocation Loc) const
Description
Returns true if \p Loc did not come from a PCH/Module.
Declared at: clang/include/clang/Basic/SourceManager.h:1746
Parameters
¶bool isMacroArgExpansion(
clang::SourceLocation Loc,
clang::SourceLocation* StartLoc =
nullptr) const
bool isMacroArgExpansion(
clang::SourceLocation Loc,
clang::SourceLocation* StartLoc =
nullptr) const
Description
Tests whether the given source location represents a macro argument's expansion into the function-like macro definition. Such source locations only appear inside of the expansion locations representing where a particular function-like macro was expanded.
Declared at: clang/include/clang/Basic/SourceManager.h:1305
Parameters
- clang::SourceLocation Loc
- clang::SourceLocation* StartLoc = nullptr
- If non-null and function returns true, it is set to the start location of the macro argument expansion.
¶bool isMacroBodyExpansion(
clang::SourceLocation Loc) const
bool isMacroBodyExpansion(
clang::SourceLocation Loc) const
Description
Tests whether the given source location represents the expansion of a macro body. This is equivalent to testing whether the location is part of a macro expansion but not the expansion of an argument to a function-like macro.
Declared at: clang/include/clang/Basic/SourceManager.h:1313
Parameters
¶bool isMainFile(
const clang::FileEntry& SourceFile)
bool isMainFile(
const clang::FileEntry& SourceFile)
Description
Returns true when the given FileEntry corresponds to the main file. The main file should be set prior to calling this function.
Declared at: clang/include/clang/Basic/SourceManager.h:851
Parameters
- const clang::FileEntry& SourceFile
¶inline bool isOffsetInFileID(
clang::FileID FID,
SourceLocation::UIntTy SLocOffset) const
inline bool isOffsetInFileID(
clang::FileID FID,
SourceLocation::UIntTy SLocOffset) const
Description
Return true if the specified FileID contains the specified SourceLocation offset. This is a very hot method.
Declared at: clang/include/clang/Basic/SourceManager.h:1826
Parameters
- clang::FileID FID
- SourceLocation::UIntTy SLocOffset
¶bool isPointWithin(
clang::SourceLocation Location,
clang::SourceLocation Start,
clang::SourceLocation End) const
bool isPointWithin(
clang::SourceLocation Location,
clang::SourceLocation Start,
clang::SourceLocation End) const
Description
Return true if the Point is within Start and End.
Declared at: clang/include/clang/Basic/SourceManager.h:1670
Parameters
- clang::SourceLocation Location
- clang::SourceLocation Start
- clang::SourceLocation End
¶bool isWrittenInBuiltinFile(
clang::SourceLocation Loc) const
bool isWrittenInBuiltinFile(
clang::SourceLocation Loc) const
Description
Returns whether \p Loc is located in a <built -in> file.
Declared at: clang/include/clang/Basic/SourceManager.h:1475
Parameters
¶bool isWrittenInCommandLineFile(
clang::SourceLocation Loc) const
bool isWrittenInCommandLineFile(
clang::SourceLocation Loc) const
Description
Returns whether \p Loc is located in a <command line> file.
Declared at: clang/include/clang/Basic/SourceManager.h:1484
Parameters
¶bool isWrittenInMainFile(
clang::SourceLocation Loc) const
bool isWrittenInMainFile(
clang::SourceLocation Loc) const
Description
Returns true if the spelling location for the given location is in the main file buffer. This check ignores line marker directives.
Declared at: clang/include/clang/Basic/SourceManager.h:1470
Parameters
¶bool isWrittenInSameFile(
clang::SourceLocation Loc1,
clang::SourceLocation Loc2) const
bool isWrittenInSameFile(
clang::SourceLocation Loc1,
clang::SourceLocation Loc2) const
Description
Returns true if the spelling locations for both SourceLocations are part of the same file buffer. This check ignores line marker directives.
Declared at: clang/include/clang/Basic/SourceManager.h:1462
Parameters
¶bool isWrittenInScratchSpace(
clang::SourceLocation Loc) const
bool isWrittenInScratchSpace(
clang::SourceLocation Loc) const
Description
Returns whether \p Loc is located in a <scratch space> file.
Declared at: clang/include/clang/Basic/SourceManager.h:1493
Parameters
¶const SrcMgr::SLocEntry& loadSLocEntry(
unsigned int Index,
bool* Invalid) const
const SrcMgr::SLocEntry& loadSLocEntry(
unsigned int Index,
bool* Invalid) const
Declared at: clang/include/clang/Basic/SourceManager.h:1787
Parameters
- unsigned int Index
- bool* Invalid
¶unsigned int loaded_sloc_entry_size() const
unsigned int loaded_sloc_entry_size() const
Description
Get the number of loaded SLocEntries we have.
Declared at: clang/include/clang/Basic/SourceManager.h:1702
¶unsigned int local_sloc_entry_size() const
unsigned int local_sloc_entry_size() const
Description
Get the number of local SLocEntries we have.
Declared at: clang/include/clang/Basic/SourceManager.h:1693
¶void overrideFileContents(
const clang::FileEntry* SourceFile,
const clang::FileEntry* NewFile)
void overrideFileContents(
const clang::FileEntry* SourceFile,
const clang::FileEntry* NewFile)
Description
Override the given source file with another one.
Declared at: clang/include/clang/Basic/SourceManager.h:977
Parameters
- const clang::FileEntry* SourceFile
- the source file which will be overridden.
- const clang::FileEntry* NewFile
- the file whose contents will be used as the data instead of the contents of the given source file.
¶void overrideFileContents(
clang::FileEntryRef SourceFile,
std::unique_ptr<llvm::MemoryBuffer> Buffer)
void overrideFileContents(
clang::FileEntryRef SourceFile,
std::unique_ptr<llvm::MemoryBuffer> Buffer)
Declared at: clang/include/clang/Basic/SourceManager.h:966
Parameters
- clang::FileEntryRef SourceFile
- std::unique_ptr<llvm::MemoryBuffer> Buffer
¶void overrideFileContents(
const clang::FileEntry* SourceFile,
std::unique_ptr<llvm::MemoryBuffer> Buffer)
void overrideFileContents(
const clang::FileEntry* SourceFile,
std::unique_ptr<llvm::MemoryBuffer> Buffer)
Description
Override the contents of the given source file by providing an already-allocated buffer.
Declared at: clang/include/clang/Basic/SourceManager.h:964
Parameters
- const clang::FileEntry* SourceFile
- the source file whose contents will be overridden.
- std::unique_ptr<llvm::MemoryBuffer> Buffer
- the memory buffer whose contents will be used as the data in the given source file.
¶void overrideFileContents(
const clang::FileEntry* SourceFile,
const llvm::MemoryBufferRef& Buffer)
void overrideFileContents(
const clang::FileEntry* SourceFile,
const llvm::MemoryBufferRef& Buffer)
Description
Override the contents of the given source file by providing an already-allocated buffer.
Declared at: clang/include/clang/Basic/SourceManager.h:952
Parameters
- const clang::FileEntry* SourceFile
- the source file whose contents will be overridden.
- const llvm::MemoryBufferRef& Buffer
- the memory buffer whose contents will be used as the data in the given source file.
¶void pushModuleBuildStack(
llvm::StringRef moduleName,
clang::FullSourceLoc importLoc)
void pushModuleBuildStack(
llvm::StringRef moduleName,
clang::FullSourceLoc importLoc)
Description
Push an entry to the module build stack.
Declared at: clang/include/clang/Basic/SourceManager.h:832
Parameters
- llvm::StringRef moduleName
- clang::FullSourceLoc importLoc
¶void setAllFilesAreTransient(bool Transient)
void setAllFilesAreTransient(bool Transient)
Description
Specify that all files that are read during this compilation are transient.
Declared at: clang/include/clang/Basic/SourceManager.h:1004
Parameters
- bool Transient
¶void setExternalSLocEntrySource(
clang::ExternalSLocEntrySource* Source)
void setExternalSLocEntrySource(
clang::ExternalSLocEntrySource* Source)
Declared at: clang/include/clang/Basic/SourceManager.h:1724
Parameters
- clang::ExternalSLocEntrySource* Source
¶void setFileIsTransient(
const clang::FileEntry* SourceFile)
void setFileIsTransient(
const clang::FileEntry* SourceFile)
Description
Specify that a file is transient.
Declared at: clang/include/clang/Basic/SourceManager.h:1000
Parameters
- const clang::FileEntry* SourceFile
¶void setMainFileID(clang::FileID FID)
void setMainFileID(clang::FileID FID)
Description
Set the file ID for the main source file.
Declared at: clang/include/clang/Basic/SourceManager.h:844
Parameters
- clang::FileID FID
¶void setModuleBuildStack(
clang::ModuleBuildStack stack)
void setModuleBuildStack(
clang::ModuleBuildStack stack)
Description
Set the module build stack.
Declared at: clang/include/clang/Basic/SourceManager.h:826
Parameters
- clang::ModuleBuildStack stack
¶void setNumCreatedFIDsForFileID(
clang::FileID FID,
unsigned int NumFIDs,
bool Force = false) const
void setNumCreatedFIDsForFileID(
clang::FileID FID,
unsigned int NumFIDs,
bool Force = false) const
Description
Set the number of FileIDs (files and macros) that were created during preprocessing of \p FID, including it.
Declared at: clang/include/clang/Basic/SourceManager.h:1089
Parameters
- clang::FileID FID
- unsigned int NumFIDs
- bool Force = false
¶void setOverridenFilesKeepOriginalName(bool value)
void setOverridenFilesKeepOriginalName(bool value)
Description
Set true if the SourceManager should report the original file name for contents of files that were overridden by other files. Defaults to true.
Declared at: clang/include/clang/Basic/SourceManager.h:812
Parameters
- bool value
¶void setPreambleFileID(clang::FileID Preamble)
void setPreambleFileID(clang::FileID Preamble)
Description
Set the file ID for the precompiled preamble.
Declared at: clang/include/clang/Basic/SourceManager.h:854
Parameters
- clang::FileID Preamble
¶clang::FileID translateFile(
clang::FileEntryRef SourceFile) const
clang::FileID translateFile(
clang::FileEntryRef SourceFile) const
Declared at: clang/include/clang/Basic/SourceManager.h:1612
Parameters
- clang::FileEntryRef SourceFile
¶clang::FileID translateFile(
const clang::FileEntry* SourceFile) const
clang::FileID translateFile(
const clang::FileEntry* SourceFile) const
Description
Get the FileID for the given file. If the source file is included multiple times, the FileID will be the first inclusion.
Declared at: clang/include/clang/Basic/SourceManager.h:1611
Parameters
- const clang::FileEntry* SourceFile
¶clang::SourceLocation translateFileLineCol(
const clang::FileEntry* SourceFile,
unsigned int Line,
unsigned int Col) const
clang::SourceLocation translateFileLineCol(
const clang::FileEntry* SourceFile,
unsigned int Line,
unsigned int Col) const
Description
Get the source location for the given file:line:col triplet. If the source file is included multiple times, the source location will be based upon the first inclusion.
Declared at: clang/include/clang/Basic/SourceManager.h:1604
Parameters
- const clang::FileEntry* SourceFile
- unsigned int Line
- unsigned int Col
¶clang::SourceLocation translateLineCol(
clang::FileID FID,
unsigned int Line,
unsigned int Col) const
clang::SourceLocation translateLineCol(
clang::FileID FID,
unsigned int Line,
unsigned int Col) const
Description
Get the source location in \p FID for the given line:col. Returns null location if \p FID is not a file SLocEntry.
Declared at: clang/include/clang/Basic/SourceManager.h:1618
Parameters
- clang::FileID FID
- unsigned int Line
- unsigned int Col
¶bool userFilesAreVolatile() const
bool userFilesAreVolatile() const
Description
True if non-system source files should be treated as volatile (likely to change while trying to use them).
Declared at: clang/include/clang/Basic/SourceManager.h:818
¶~SourceManager()
~SourceManager()
Declared at: clang/include/clang/Basic/SourceManager.h:797