This class handles loading and caching of source files into memory. More...
#include "clang/Basic/SourceManager.h"
Old
.
SourceFile
if it exists.
TokenStart
ends prematurely at TokenEnd
.
FID
, including it.
FID
, including it.
FID
is a #include'd file otherwise it returns an invalid location.
Loc
, return the expansion location referenced by the ID.
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.
Loc
is inside the [Start
, +Length
) chunk of the source location address space.
LHS
and RHS
are in the local source location address space or the loaded one.
Loc
is located in a <built-in> file.
Loc
is located in a <command line> file.
Loc
is located in a <scratch space> file.
Loc
is expanded from a macro in a system header.
FID
represents.
Loc
is inside that FileID chunk and sets relative offset (offset of Loc
from beginning of FileID) to relativeOffset
.
FID
for the given line:col.
Loc
points inside a function macro argument, the returned location will be the macro location in which the argument was expanded.
Loc
came from a PCH/Module.
Loc
did not come from a PCH/Module.
FID
came from a PCH/Module.
FID
did not come from a PCH/Module.
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.
Definition at line 663 of file SourceManager.h.
◆ fileinfo_iterator ◆ SourceManager() [1/2] ◆ SourceManager() [2/2] ◆ ~SourceManager() SourceManager::~SourceManager ( ) ◆ AddLineNote() ◆ AllocateLoadedSLocEntries()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.
Definition at line 455 of file SourceManager.cpp.
References int.
◆ bypassFileContentsOverride() ◆ clearIDTables() void SourceManager::clearIDTables ( ) ◆ createExpansionLoc() ◆ createFileID() [1/3] ◆ createFileID() [2/3]Create a new FileID that represents the specified file being #included from the specified IncludePosition.
Definition at line 536 of file SourceManager.cpp.
References clang::SrcMgr::ContentCache::ContentsEntry, clang::SrcMgr::ContentCache::getBufferOrNone(), getFileManager(), clang::FileEntryRef::getName(), clang::FileEntryRef::isNamedPipe(), and clang::SrcMgr::isSystem().
Referenced by clang::tooling::applyAllReplacements(), clang::FrontendAction::BeginSourceFile(), ConvertBackendLocation(), createFileID(), clang::Preprocessor::EnterMainSourceFile(), getOrCreateFileID(), clang::ASTImporter::Import(), clang::CompilerInstance::InitializeSourceManager(), clang::SourceMgrAdapter::mapLocation(), and clang::ModuleMap::parseModuleMapFile().
◆ createFileID() [3/3]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.
Definition at line 557 of file SourceManager.cpp.
◆ createMacroArgExpansionLoc() ◆ createTokenSplitLoc() ◆ dump() LLVM_DUMP_METHOD void SourceManager::dump ( ) const ◆ fileinfo_begin() ◆ fileinfo_end() ◆ getBufferData() StringRef SourceManager::getBufferData ( FileID FID, bool * Invalid =nullptr
) const ◆ getBufferDataIfLoaded() std::optional< StringRef > SourceManager::getBufferDataIfLoaded ( FileID FID ) const ◆ getBufferDataOrNone() std::optional< StringRef > SourceManager::getBufferDataOrNone ( FileID FID ) const ◆ getBufferName() StringRef SourceManager::getBufferName ( SourceLocation Loc, bool * Invalid = nullptr
) const ◆ getBufferOrFake() ◆ getBufferOrNone() ◆ getCharacterData() const char * SourceManager::getCharacterData ( SourceLocation SL, bool * Invalid = nullptr
) const
Return a pointer to the start of the specified location in the appropriate spelling MemoryBuffer.
getCharacterData - Return a pointer to the start of the specified location in the appropriate MemoryBuffer.
true
if an error occurs.
Definition at line 1124 of file SourceManager.cpp.
References clang::SrcMgr::ContentCache::getBufferOrNone(), clang::SrcMgr::FileInfo::getContentCache(), getDecomposedSpellingLoc(), clang::SrcMgr::SLocEntry::getFile(), getFileManager(), getSLocEntry(), clang::Invalid, and clang::SrcMgr::SLocEntry::isFile().
Referenced by clang::Preprocessor::DumpToken(), fixItNullability(), clang::FullSourceLoc::getCharacterData(), clang::Rewriter::getRewrittenText(), clang::Lexer::getSpelling(), and isSameWidthConstantConversion().
◆ getColumnNumber() ◆ getComposedLoc() ◆ getContentCacheSize() size_t clang::SourceManager::getContentCacheSize ( ) const inlineReturn the total amount of physical memory allocated by the ContentCache allocator.
Definition at line 1607 of file SourceManager.h.
◆ getDataStructureSizes() size_t SourceManager::getDataStructureSizes ( ) const ◆ getDecomposedExpansionLoc() ◆ getDecomposedIncludedLoc() ◆ getDecomposedLoc()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.
Definition at line 1272 of file SourceManager.h.
References getFileID(), and Loc.
Referenced by clang::RawCommentList::addComment(), clang::ASTContext::attachCommentsToJustParsedDecls(), clang::RawCommentList::getCommentEndOffset(), clang::FullSourceLoc::getDecomposedLoc(), getFileOffset(), getImmediateSpellingLoc(), getRangeSize(), clang::ASTContext::getRawCommentForDeclNoCache(), clang::ASTContext::getRawCommentForDeclNoCacheImpl(), clang::comments::Lexer::getSpelling(), clang::ASTImporter::Import(), isAtStartOfImmediateMacroExpansion(), loadModuleMapForModuleBuild(), clang::Sema::notePreviousDefinition(), clang::ModuleMap::parseModuleMapFile(), clang::RawComment::RawComment(), and clang::ASTReader::ReadComments().
◆ getDecomposedSpellingLoc() ◆ getDiagnostics() ◆ getExpansionColumnNumber() ◆ getExpansionLineNumber() ◆ getExpansionLoc()Given a SourceLocation object Loc
, return the expansion location referenced by the ID.
Definition at line 1194 of file SourceManager.h.
References Loc.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnUsingDirective(), clang::ast_matchers::AST_POLYMORPHIC_MATCHER(), clang::ast_matchers::AST_POLYMORPHIC_MATCHER_REGEX(), clang::api_notes::APINotesManager::findAPINotes(), getDeclLocsForCommentSearch(), clang::FullSourceLoc::getExpansionLoc(), getIssueHash(), clang::Preprocessor::getModuleForLocation(), getNullabilityCompletenessCheckFileID(), clang::diff::SyntaxTree::getSourceRangeOffsets(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), handleObjCOwnershipTypeAttr(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), clang::Sema::InstantiateClass(), clang::Sema::InstantiateFunctionDefinition(), and clang::CodeGen::CGDebugInfo::setLocation().
◆ getExpansionRange() [1/3] ◆ getExpansionRange() [2/3]Given a SourceLocation object, return the range of tokens covered by the expansion in the ultimate file.
getExpansionRange - Given a SourceLocation object, return the range of tokens covered by the expansion in the ultimate file.
Definition at line 1008 of file SourceManager.cpp.
References clang::CharSourceRange::getBegin(), clang::CharSourceRange::getEnd(), getImmediateExpansionRange(), clang::SourceLocation::isFileID(), clang::CharSourceRange::isTokenRange(), Loc, clang::CharSourceRange::setBegin(), clang::CharSourceRange::setEnd(), and clang::CharSourceRange::setTokenRange().
Referenced by clang::SourceLocExpr::EvaluateInContext(), and getExpansionRange().
◆ getExpansionRange() [3/3] ◆ getFileCharacteristic()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.
getFileCharacteristic - 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.
This state can be modified with flags on GNU linemarker directives like:
4 "foo.h" 3which changes all source locations in the current file after that to be considered to be from a system header.
Definition at line 1440 of file SourceManager.cpp.
References clang::SrcMgr::C_User, clang::LineEntry::FileKind, clang::SrcMgr::SLocEntry::getFile(), clang::SrcMgr::FileInfo::getFileCharacteristic(), clang::SrcMgr::FileInfo::hasLineDirectives(), clang::SourceLocation::isValid(), and Loc.
Referenced by compileModule(), clang::Preprocessor::HandleEndOfFile(), isInExternCSystemHeader(), and isInSystemHeader().
◆ getFileEntryForID() const FileEntry * clang::SourceManager::getFileEntryForID ( FileID FID ) const inline ◆ getFileEntryForSLocEntry() ◆ getFileEntryRefForID()Returns the FileEntryRef for the provided FileID.
Definition at line 1077 of file SourceManager.h.
Referenced by clang::ast_matchers::AST_POLYMORPHIC_MATCHER_REGEX(), clang::PrecompiledPreamble::Build(), compileModule(), clang::ModuleMap::createModuleForInterfaceUnit(), clang::syntax::TokenBuffer::dumpForTests(), clang::tooling::dependencies::ModuleDepCollectorPP::EndOfMainFile(), clang::Preprocessor::EnterMainSourceFile(), clang::Preprocessor::EnterSourceFile(), clang::api_notes::APINotesManager::findAPINotes(), clang::ModuleMap::getContainingModuleMapFile(), clang::PreprocessorLexer::getFileEntry(), getFileEntryForID(), clang::FullSourceLoc::getFileEntryRef(), getFilename(), clang::ASTUnit::getMainFileName(), clang::Preprocessor::getModuleForLocation(), clang::ModuleMap::getModuleMapFileForUniquing(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), clang::Preprocessor::LookupFile(), clang::Sema::notePreviousDefinition(), clang::Rewriter::overwriteChangedFiles(), prepareToBuildModule(), and PrintUnexpected().
◆ getFileID()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.
Definition at line 1145 of file SourceManager.h.
References getFileID().
Referenced by clang::Sema::ActOnAnnotModuleEnd(), clang::ast_matchers::AST_POLYMORPHIC_MATCHER_REGEX(), checkConfigMacro(), compileModule(), createTokenSplitLoc(), clang::Sema::diagnoseMissingImport(), DiagnoseNullConversion(), EvaluateDefined(), clang::api_notes::APINotesManager::findAPINotes(), clang::tooling::findSelectedASTNodes(), clang::FullSourceLoc::getBufferData(), clang::ModuleMap::getContainingModuleMapFileID(), getDecomposedExpansionLoc(), getDecomposedLoc(), getDecomposedSpellingLoc(), clang::FullSourceLoc::getFileID(), getFileID(), getFilename(), getImmediateExpansionRange(), clang::Preprocessor::getModuleForLocation(), getModuleImportLoc(), getNullabilityCompletenessCheckFileID(), clang::ScratchBuffer::getToken(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), clang::Preprocessor::HandleDirective(), clang::ento::PathDiagnosticConsumer::HandlePathDiagnostic(), clang::ASTImporter::Import(), isAtEndOfImmediateMacroExpansion(), isMacroArgExpansion(), isMacroBodyExpansion(), isWrittenInMainFile(), isWrittenInSameFile(), PrintUnexpected(), shouldIgnoreMacro(), clang::syntax::TokenBuffer::spelledForExpanded(), and clang::syntax::TokenBuffer::spelledTokenContaining().
◆ getFileIDSize() ◆ getFileLoc() ◆ getFileManager() FileManager & clang::SourceManager::getFileManager ( ) const inlineDefinition at line 854 of file SourceManager.h.
Referenced by clang::PrecompiledPreamble::Build(), clang::ModuleMap::canonicalizeModuleMapPath(), clang::SemaCodeCompletion::CodeCompleteIncludedFile(), createFileID(), clang::api_notes::APINotesManager::findAPINotes(), clang::BackendConsumer::getBestLocationFromDebugLoc(), getBufferDataOrNone(), getBufferOrNone(), getCharacterData(), clang::api_notes::APINotesManager::getCurrentModuleAPINotes(), getMemoryBufferForFileOrNone(), clang::ASTImporter::Import(), clang::ModuleMap::isHeaderUnavailableInModule(), and clang::Rewriter::overwriteChangedFiles().
◆ getFilename() StringRef SourceManager::getFilename ( SourceLocation SpellingLoc ) const ◆ getFileOffset() ◆ getImmediateExpansionRange()Return the start/end of the expansion information for an expansion location.
getImmediateExpansionRange - Loc is required to be an expansion location.
Loc
is required to be an expansion location.
Return the start/end of the expansion information.
Definition at line 994 of file SourceManager.cpp.
References clang::SrcMgr::SLocEntry::getExpansion(), clang::SrcMgr::ExpansionInfo::getExpansionLocRange(), getFileID(), getSLocEntry(), clang::SourceLocation::isMacroID(), and Loc.
Referenced by CheckMoveOnConstruction(), clang::Sema::DiagnoseAbsenceOfOverrideControl(), DiagnoseNullConversion(), getExpansionRange(), GetFullTypeForDeclarator(), getImmediateMacroCallerLoc(), and handleObjCOwnershipTypeAttr().
◆ getImmediateMacroCallerLoc() ◆ getImmediateSpellingLoc() ◆ getIncludeLoc() ◆ getLineNumber()Given a SourceLocation, return the spelling line number for the position indicated.
getLineNumber - 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.
Definition at line 1315 of file SourceManager.cpp.
References clang::SrcMgr::LineOffsetMapping::begin(), Diag(), clang::SrcMgr::LineOffsetMapping::end(), clang::SrcMgr::LineOffsetMapping::get(), clang::SrcMgr::ContentCache::getBufferOrNone(), clang::SrcMgr::FileInfo::getContentCache(), clang::SrcMgr::SLocEntry::getFile(), clang::Invalid, clang::SrcMgr::SLocEntry::isFile(), clang::FileID::isInvalid(), and clang::SrcMgr::ContentCache::SourceLineCache.
Referenced by clang::RawCommentList::getCommentBeginLine(), clang::FullSourceLoc::getLineNumber(), clang::ASTContext::getRawCommentForDeclNoCacheImpl(), clang::Rewriter::IncreaseIndentation(), and clang::Rewriter::InsertText().
◆ getLineTable() ◆ getLineTableFilenameID() unsigned SourceManager::getLineTableFilenameID ( StringRef Str ) ◆ getLoadedSLocEntry() [1/2] ◆ getLoadedSLocEntry() [2/2] ◆ getLocalSLocEntry() [1/2]Get a local SLocEntry. This is exposed for indexing.
Definition at line 1746 of file SourceManager.h.
◆ getLocalSLocEntry() [2/2] ◆ getLocForEndOfFile() ◆ getLocForStartOfFile()Return the source location corresponding to the first byte of the specified file.
Definition at line 1154 of file SourceManager.h.
Referenced by clang::Sema::ActOnModuleDecl(), clang::html::AddHeaderFooterInternalBuiltinCSS(), ConvertBackendLocation(), clang::Preprocessor::EnterSourceFile(), clang::ASTUnit::getStartOfMainFileID(), clang::Preprocessor::HandleEndOfFile(), clang::ASTImporter::Import(), clang::SourceMgrAdapter::mapLocation(), clang::ASTUnit::mapLocationFromPreamble(), clang::ASTUnit::mapLocationToPreamble(), and clang::ModuleMap::parseModuleMapFile().
◆ getMacroArgExpandedLocation()If Loc
points inside a function macro argument, the returned location will be the macro location in which the argument was expanded.
If.
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.
Definition at line 1888 of file SourceManager.cpp.
References clang::SourceLocation::getLocWithOffset(), clang::SourceLocation::isFileID(), clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), clang::SourceLocation::isValid(), and Loc.
◆ getMainFileID() FileID clang::SourceManager::getMainFileID ( ) const inlineReturns the FileID of the main source file.
Definition at line 888 of file SourceManager.h.
Referenced by clang::Sema::ActOnModuleDecl(), clang::PrecompiledPreamble::Build(), clang::ModuleMap::createModuleForImplementationUnit(), clang::ModuleMap::createModuleForInterfaceUnit(), clang::tooling::dependencies::ModuleDepCollectorPP::EndOfMainFile(), clang::Preprocessor::EnterMainSourceFile(), clang::ASTUnit::getMainFileName(), clang::ASTUnit::getStartOfMainFileID(), clang::ASTImporter::Import(), clang::CompilerInstance::InitializeSourceManager(), clang::ASTUnit::isInMainFileID(), isWrittenInMainFile(), clang::Preprocessor::LookupFile(), clang::ASTUnit::mapLocationFromPreamble(), clang::ASTUnit::mapLocationToPreamble(), prepareToBuildModule(), ReadOriginalFileName(), and clang::Preprocessor::SetCodeCompletionPoint().
◆ getMemoryBufferForFileOrFake() llvm::MemoryBufferRef clang::SourceManager::getMemoryBufferForFileOrFake ( FileEntryRef File ) inline ◆ getMemoryBufferForFileOrNone() std::optional< llvm::MemoryBufferRef > SourceManager::getMemoryBufferForFileOrNone ( FileEntryRef File ) ◆ getMemoryBufferSizes()Return the amount of memory used by memory buffers, breaking down by heap-backed versus mmap'ed memory.
Definition at line 2352 of file SourceManager.cpp.
◆ getModuleBuildStack() ◆ getModuleImportLoc() ◆ getNextLocalOffset() ◆ getNonBuiltinFilenameForID() std::optional< StringRef > SourceManager::getNonBuiltinFilenameForID ( FileID FID ) const ◆ getNumCreatedFIDsForFileID() unsigned clang::SourceManager::getNumCreatedFIDsForFileID ( FileID FID ) const inlineGet the number of FileIDs (files and macros) that were created during preprocessing of FID
, including it.
Definition at line 1118 of file SourceManager.h.
◆ getOrCreateFileID() ◆ getPreambleFileID() FileID clang::SourceManager::getPreambleFileID ( ) const inline ◆ getPresumedColumnNumber() ◆ getPresumedLineNumber() ◆ getPresumedLoc()Returns the "presumed" location of a SourceLocation specifies.
getPresumedLoc - This method 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.
Loc
is invalid or the file containing Loc
has changed on disk), returns an invalid presumed location.
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.
Definition at line 1486 of file SourceManager.cpp.
References clang::C, Diag(), Filename, clang::SrcMgr::FileInfo::getContentCache(), clang::SrcMgr::SLocEntry::getFile(), clang::SrcMgr::FileInfo::getIncludeLoc(), clang::SourceLocation::getLocWithOffset(), clang::SrcMgr::FileInfo::hasLineDirectives(), clang::Invalid, clang::SrcMgr::SLocEntry::isFile(), clang::SourceLocation::isInvalid(), and Loc.
Referenced by clang::CodeGen::CGDebugInfo::AddStringLiteralDebugInfo(), clang::DoPrintPreprocessedInput(), clang::TextNodeDumper::dumpLocation(), emitMappingInformation(), clang::CodeGen::CGOpenMPRuntime::emitUpdateLocation(), clang::SourceLocExpr::EvaluateInContext(), clang::RawComment::getFormattedLines(), clang::AnalysisDeclContext::getFunctionName(), getIdentStringFromSourceLocation(), clang::CIRGen::CIRGenModule::getLoc(), getPresumedColumnNumber(), clang::FullSourceLoc::getPresumedLoc(), clang::Preprocessor::HandlePragmaSystemHeader(), isWrittenInBuiltinFile(), isWrittenInCommandLineFile(), and isWrittenInScratchSpace().
◆ getSLocEntry() [1/2] ◆ getSLocEntry() [2/2]Definition at line 1770 of file SourceManager.h.
References getSLocEntry(), and clang::Invalid.
Referenced by EvaluateDefined(), getCharacterData(), getImmediateExpansionRange(), getImmediateSpellingLoc(), getNullabilityCompletenessCheckFileID(), getSLocEntry(), clang::ScratchBuffer::getToken(), clang::ASTImporter::Import(), clang::Rewriter::IncreaseIndentation(), clang::Rewriter::InsertText(), isAtEndOfImmediateMacroExpansion(), isAtStartOfImmediateMacroExpansion(), isInFileID(), isMacroArgExpansion(), and isMacroBodyExpansion().
◆ getSpellingColumnNumber() ◆ getSpellingLineNumber() ◆ getSpellingLoc() ◆ getTopMacroCallerLoc() ◆ getUniqueLoadedASTFileID()Loc
is at.
Definition at line 1950 of file SourceManager.cpp.
References Loc.
◆ hasFileInfo() bool clang::SourceManager::hasFileInfo ( const FileEntry * File ) const inline ◆ hasLineTable() bool clang::SourceManager::hasLineTable ( ) const inlineDetermine if the source manager has a line table.
Definition at line 1596 of file SourceManager.h.
◆ initializeForReplay() void SourceManager::initializeForReplay ( const SourceManager & Old ) ◆ isAtEndOfImmediateMacroExpansion()Returns true if the given MacroID location points at the character end of the immediate macro expansion.
Definition at line 1082 of file SourceManager.cpp.
References clang::SrcMgr::SLocEntry::getExpansion(), clang::SrcMgr::ExpansionInfo::getExpansionLocEnd(), clang::SrcMgr::ExpansionInfo::getExpansionLocStart(), getFileID(), clang::SourceLocation::getLocWithOffset(), getSLocEntry(), clang::Invalid, clang::SrcMgr::SLocEntry::isExpansion(), isInFileID(), clang::FileID::isInvalid(), clang::SrcMgr::ExpansionInfo::isMacroArgExpansion(), clang::SourceLocation::isMacroID(), clang::SourceLocation::isValid(), and Loc.
◆ isAtStartOfImmediateMacroExpansion()Returns true if the given MacroID location points at the beginning of the immediate macro expansion.
Definition at line 1047 of file SourceManager.cpp.
References getDecomposedLoc(), clang::SrcMgr::SLocEntry::getExpansion(), clang::SrcMgr::ExpansionInfo::getExpansionLocStart(), getSLocEntry(), clang::Invalid, clang::SrcMgr::SLocEntry::isExpansion(), clang::FileID::isInvalid(), clang::SrcMgr::ExpansionInfo::isMacroArgExpansion(), clang::SourceLocation::isMacroID(), clang::SourceLocation::isValid(), and Loc.
Referenced by CheckMoveOnConstruction().
◆ isBeforeInSLocAddrSpace() [1/2] ◆ isBeforeInSLocAddrSpace() [2/2]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
Definition at line 1699 of file SourceManager.h.
◆ isBeforeInTranslationUnit()Determines the order of 2 source locations in the translation unit.
Definition at line 2038 of file SourceManager.cpp.
References clang::SourceLocation::isValid().
Referenced by clang::PreprocessingRecord::addPreprocessedEntity(), clang::format::AffectedRangeManager::affectsCharSourceRange(), diagnoseRepeatedUseOfWeak(), clang::PPConditionalDirectiveRecord::findConditionalDirectiveRegionLoc(), clang::DeclSpec::Finish(), clang::Preprocessor::getLastMacroWithSpelling(), clang::syntax::TreeBuilder::getRange(), clang::FullSourceLoc::isBeforeInTranslationUnitThan(), isPointWithin(), clang::Preprocessor::isSafeBufferOptOut(), clang::format::WhitespaceManager::Change::IsBeforeInFile::operator()(), clang::PPConditionalDirectiveRecord::rangeIntersectsConditionalDirective(), and clang::LexicallyOrderedRecursiveASTVisitor< Derived >::TraverseDeclContextHelper().
◆ isFileOverridden() bool clang::SourceManager::isFileOverridden ( const FileEntry * File ) const inline ◆ isInExternCSystemHeader() ◆ isInFileID() ◆ isInMainFile()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.
Definition at line 1562 of file SourceManager.cpp.
References clang::SrcMgr::SLocEntry::getFile(), clang::SrcMgr::FileInfo::getIncludeLoc(), clang::SrcMgr::FileInfo::hasLineDirectives(), clang::SourceLocation::isInvalid(), and Loc.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnUsingDirective(), clang::ast_matchers::AST_POLYMORPHIC_MATCHER(), CheckUnreachable(), diagnoseUseOfInternalDeclInInlineFunction(), clang::Preprocessor::getModuleForLocation(), clang::Preprocessor::HandlePragmaHdrstop(), isMainFileLoc(), and clang::diff::isNodeExcluded().
◆ isInSameSLocAddrSpace()Return true if both LHS
and RHS
are in the local source location address space or the loaded one.
If it's true and RelativeOffset
is non-null, it will be set to the offset of RHS
relative to LHS
.
Definition at line 1393 of file SourceManager.h.
◆ isInSLocAddrSpace()Returns true if Loc
is inside the [Start
, +Length
) chunk of the source location address space.
If it's true and RelativeOffset
is non-null, it will be set to the relative offset of Loc
inside the chunk.
Definition at line 1369 of file SourceManager.h.
References Loc.
◆ isInSystemHeader()Returns if a SourceLocation is in a system header.
Definition at line 1533 of file SourceManager.h.
References getFileCharacteristic(), and Loc.
Referenced by clang::SemaObjC::ActOnAtEnd(), clang::Sema::ActOnCXXTryBlock(), clang::Sema::ActOnLabelStmt(), clang::ASTContext::addComment(), clang::ast_matchers::AST_POLYMORPHIC_MATCHER(), clang::Sema::BuildCXXThrow(), CheckConstexprFunctionBody(), clang::Sema::CheckEquivalentExceptionSpec(), clang::SemaObjC::checkInitMethod(), clang::Preprocessor::CheckMacroName(), CheckSimplerImplicitMovesMSVCWorkaround(), DiagnoseBadConversion(), DiagReservedModuleName(), DoEmitAvailabilityWarning(), EmitDiagForCXXThrowInNonThrowingFunc(), clang::Preprocessor::getHeaderToIncludeForDiagnostics(), clang::ento::MemRegionManager::getVarRegion(), handleInitPriorityAttr(), clang::Sema::InstantiateFunctionDefinition(), clang::TemplateDeclInstantiator::InstantiateTypedefNameDecl(), isForbiddenTypeAllowed(), clang::FullSourceLoc::isInSystemHeader(), clang::extractapi::impl::ExtractAPIVisitorBase< Derived >::isInSystemHeader(), isInSystemMacro(), clang::Sema::isLibstdcxxEagerExceptionSpecHack(), isLibstdcxxPointerReturnFalseHack(), isStandardNew(), clang::sema::AnalysisBasedWarnings::IssueWarnings(), clang::Sema::makeUnavailableInSystemHeader(), clang::Sema::maybeAddDeclWithEffects(), clang::SemaCUDA::maybeAddHostDeviceAttrs(), clang::Sema::MergeTypedefNameDecl(), clang::SemaObjC::ParseObjCSelectorExpression(), and shouldIgnoreDueToReservedName().
◆ isInSystemMacro()Returns whether Loc
is expanded from a macro in a system header.
Definition at line 1545 of file SourceManager.h.
References getImmediateMacroCallerLoc(), getSpellingLoc(), isInSystemHeader(), isInSystemMacro(), clang::SourceLocation::isMacroID(), and isWrittenInScratchSpace().
Referenced by AnalyzeBitFieldAssignment(), AnalyzeCompoundAssignment(), clang::Sema::CheckImplicitConversion(), diagnoseSubtractionOnNullPointer(), clang::Sema::diagnoseZeroToNullptrConversion(), handleStandardNoReturnAttr(), and isInSystemMacro().
◆ isInTheSameTranslationUnit() ◆ isInTheSameTranslationUnitImpl()Determines whether the two decomposed source location is in the same TU.
Definition at line 1968 of file SourceManager.cpp.
◆ isLoadedFileID() bool clang::SourceManager::isLoadedFileID ( FileID FID ) const inline ◆ isLoadedSourceLocation() ◆ isLocalFileID() bool clang::SourceManager::isLocalFileID ( FileID FID ) const inline ◆ isLocalSourceLocation() ◆ isMacroArgExpansion()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.
Definition at line 1026 of file SourceManager.cpp.
References clang::SrcMgr::SLocEntry::getExpansion(), clang::SrcMgr::ExpansionInfo::getExpansionLocStart(), getFileID(), getSLocEntry(), clang::SrcMgr::ExpansionInfo::isMacroArgExpansion(), clang::SourceLocation::isMacroID(), and Loc.
Referenced by clang::edit::EditedSource::canInsertInOffset(), getImmediateMacroCallerLoc(), getTopMacroCallerLoc(), clang::FullSourceLoc::isMacroArgExpansion(), and clang::syntax::TokenBuffer::spelledForExpanded().
◆ isMacroBodyExpansion() ◆ isMainFile() ◆ isPointWithin() ◆ isWrittenInBuiltinFile() ◆ isWrittenInCommandLineFile() ◆ isWrittenInMainFile() ◆ isWrittenInSameFile()Returns true if the spelling locations for both SourceLocations are part of the same file buffer.
This check ignores line marker directives.
Definition at line 1493 of file SourceManager.h.
References getFileID().
◆ isWrittenInScratchSpace() ◆ loaded_sloc_entry_size() unsigned clang::SourceManager::loaded_sloc_entry_size ( ) const inline ◆ local_sloc_entry_size() unsigned clang::SourceManager::local_sloc_entry_size ( ) const inline ◆ noteSLocAddressSpaceUsage() ◆ operator=() ◆ overrideFileContents() [1/3] ◆ overrideFileContents() [2/3] void clang::SourceManager::overrideFileContents ( FileEntryRef SourceFile, const llvm::MemoryBufferRef & Buffer ) inline ◆ overrideFileContents() [3/3] void SourceManager::overrideFileContents ( FileEntryRef SourceFile, std::unique_ptr< llvm::MemoryBuffer > Buffer ) ◆ PrintStats() void SourceManager::PrintStats ( ) const ◆ pushModuleBuildStack() void clang::SourceManager::pushModuleBuildStack ( StringRef moduleName, FullSourceLoc importLoc ) inline ◆ setAllFilesAreTransient() void clang::SourceManager::setAllFilesAreTransient ( bool Transient ) inline ◆ setExternalSLocEntrySource() ◆ setFileIsTransient() void SourceManager::setFileIsTransient ( FileEntryRef SourceFile ) ◆ setMainFileID() void clang::SourceManager::setMainFileID ( FileID FID ) inline ◆ setModuleBuildStack() ◆ setNumCreatedFIDsForFileID() ◆ setOverridenFilesKeepOriginalName() void clang::SourceManager::setOverridenFilesKeepOriginalName ( bool value ) inline ◆ setPreambleFileID() void clang::SourceManager::setPreambleFileID ( FileID Preamble ) inline ◆ translateFile() [1/2] ◆ translateFile() [2/2] ◆ translateFileLineCol() ◆ translateLineCol()Get the source location in FID
for the given line:col.
Get the source location in.
Returns null location if FID
is not a file SLocEntry.
Definition at line 1664 of file SourceManager.cpp.
References Diag(), clang::SrcMgr::LineOffsetMapping::get(), clang::SrcMgr::ContentCache::getBufferOrNone(), clang::SrcMgr::FileInfo::getContentCache(), clang::SrcMgr::SLocEntry::getFile(), clang::SourceLocation::getLocWithOffset(), clang::SrcMgr::SLocEntry::getOffset(), clang::Invalid, clang::SrcMgr::SLocEntry::isFile(), clang::FileID::isInvalid(), clang::Line, clang::SrcMgr::LineOffsetMapping::size(), and clang::SrcMgr::ContentCache::SourceLineCache.
◆ userFilesAreVolatile() bool clang::SourceManager::userFilesAreVolatile ( ) const inlineTrue if non-system source files should be treated as volatile (likely to change while trying to use them).
Definition at line 865 of file SourceManager.h.
◆ ASTReader ◆ ASTWriterThe documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4