clang  14.0.0git
Public Member Functions | Static Public Member Functions | Friends | List of all members
clang::SrcMgr::FileInfo Class Reference

Information about a FileID, basically just the logical file that it represents and include stack information. More...

#include "clang/Basic/SourceManager.h"

Public Member Functions

SourceLocation getIncludeLoc () const
 
const ContentCachegetContentCache () const
 
CharacteristicKind getFileCharacteristic () const
 Return whether this is a system header or not. More...
 
bool hasLineDirectives () const
 Return true if this FileID has #line directives in it. More...
 
void setHasLineDirectives ()
 Set the flag that indicates that this FileID has line table entries associated with it. More...
 
StringRef getName () const
 Returns the name of the file that was used when the file was loaded from the underlying file system. More...
 

Static Public Member Functions

static FileInfo get (SourceLocation IL, ContentCache &Con, CharacteristicKind FileCharacter, StringRef Filename)
 Return a FileInfo object. More...
 

Friends

class clang::SourceManager
 
class clang::ASTWriter
 
class clang::ASTReader
 

Detailed Description

Information about a FileID, basically just the logical file that it represents and include stack information.

Each FileInfo has include stack information, indicating where it came from. This information encodes the #include chain that a token was expanded from. The main include file has an invalid IncludeLoc.

FileInfo should not grow larger than ExpansionInfo. Doing so will cause memory to bloat in compilations with many unloaded macro expansions, since the two data structurs are stored in a union in SLocEntry. Extra fields should instead go in "ContentCache *", which stores file contents and other bits on the side.

Definition at line 282 of file SourceManager.h.

Member Function Documentation

◆ get()

static FileInfo clang::SrcMgr::FileInfo::get ( SourceLocation  IL,
ContentCache Con,
CharacteristicKind  FileCharacter,
StringRef  Filename 
)
inlinestatic

Return a FileInfo object.

Definition at line 307 of file SourceManager.h.

References clang::SrcMgr::ContentCache::Filename, Filename, and clang::tooling::X().

◆ getContentCache()

const ContentCache& clang::SrcMgr::FileInfo::getContentCache ( ) const
inline

◆ getFileCharacteristic()

CharacteristicKind clang::SrcMgr::FileInfo::getFileCharacteristic ( ) const
inline

Return whether this is a system header or not.

Definition at line 328 of file SourceManager.h.

Referenced by clang::SourceManager::getFileCharacteristic(), clang::ASTImporter::Import(), and clang::index::IndexingContext::importedModule().

◆ getIncludeLoc()

SourceLocation clang::SrcMgr::FileInfo::getIncludeLoc ( ) const
inline

◆ getName()

StringRef clang::SrcMgr::FileInfo::getName ( ) const
inline

Returns the name of the file that was used when the file was loaded from the underlying file system.

Definition at line 341 of file SourceManager.h.

References clang::SrcMgr::ContentCache::Filename, and getContentCache().

◆ hasLineDirectives()

bool clang::SrcMgr::FileInfo::hasLineDirectives ( ) const
inline

Return true if this FileID has #line directives in it.

Definition at line 333 of file SourceManager.h.

Referenced by clang::SourceManager::getFileCharacteristic(), clang::SourceManager::getPresumedLoc(), and clang::SourceManager::isInMainFile().

◆ setHasLineDirectives()

void clang::SrcMgr::FileInfo::setHasLineDirectives ( )
inline

Set the flag that indicates that this FileID has line table entries associated with it.

Definition at line 337 of file SourceManager.h.

Friends And Related Function Documentation

◆ clang::ASTReader

friend class clang::ASTReader
friend

Definition at line 285 of file SourceManager.h.

◆ clang::ASTWriter

friend class clang::ASTWriter
friend

Definition at line 284 of file SourceManager.h.

◆ clang::SourceManager

friend class clang::SourceManager
friend

Definition at line 283 of file SourceManager.h.


The documentation for this class was generated from the following file: