clang  16.0.0git
Classes | Public Types | Public Member Functions | Friends | List of all members
clang::FileEntryRef Class Reference

A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's client. More...

#include "clang/Basic/FileEntry.h"

Classes

struct  MapValue
 Type stored in the StringMap. More...
 

Public Types

using MapEntry = llvm::StringMapEntry< llvm::ErrorOr< MapValue > >
 Type used in the StringMap. More...
 

Public Member Functions

StringRef getName () const
 The name of this FileEntry. More...
 
StringRef getNameAsRequested () const
 The name of this FileEntry, as originally requested without applying any remappings for VFS 'use-external-name'. More...
 
const FileEntrygetFileEntry () const
 
DirectoryEntryRef getDir () const
 
off_t getSize () const
 
unsigned getUID () const
 
const llvm::sys::fs::UniqueID & getUniqueID () const
 
time_t getModificationTime () const
 
bool isNamedPipe () const
 
void closeFile () const
 
bool isSameRef (const FileEntryRef &RHS) const
 Check if RHS referenced the file in exactly the same way. More...
 
 operator const FileEntry * () const
 Allow FileEntryRef to degrade into 'const FileEntry*' to facilitate incremental adoption. More...
 
 FileEntryRef ()=delete
 
 FileEntryRef (const MapEntry &ME)
 
const clang::FileEntryRef::MapEntrygetMapEntry () const
 Expose the underlying MapEntry to simplify packing in a PointerIntPair or PointerUnion and allow construction in Optional. More...
 
const MapEntrygetBaseMapEntry () const
 Retrieve the base MapEntry after redirects. More...
 

Friends

class FileMgr::MapEntryOptionalStorage< FileEntryRef >
 
struct llvm::DenseMapInfo< FileEntryRef >
 
bool operator== (const FileEntryRef &LHS, const FileEntryRef &RHS)
 Check if the underlying FileEntry is the same, intentially ignoring whether the file was referenced with the same spelling of the filename. More...
 
bool operator== (const FileEntry *LHS, const FileEntryRef &RHS)
 
bool operator== (const FileEntryRef &LHS, const FileEntry *RHS)
 
bool operator!= (const FileEntryRef &LHS, const FileEntryRef &RHS)
 
bool operator!= (const FileEntry *LHS, const FileEntryRef &RHS)
 
bool operator!= (const FileEntryRef &LHS, const FileEntry *RHS)
 
llvm::hash_code hash_value (FileEntryRef Ref)
 Hash code is based on the FileEntry, not the specific named reference, just like operator==. More...
 

Detailed Description

A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's client.

Definition at line 62 of file FileEntry.h.

Member Typedef Documentation

◆ MapEntry

using clang::FileEntryRef::MapEntry = llvm::StringMapEntry<llvm::ErrorOr<MapValue> >

Type used in the StringMap.

Definition at line 117 of file FileEntry.h.

Constructor & Destructor Documentation

◆ FileEntryRef() [1/2]

clang::FileEntryRef::FileEntryRef ( )
delete

◆ FileEntryRef() [2/2]

clang::FileEntryRef::FileEntryRef ( const MapEntry ME)
inlineexplicit

Definition at line 162 of file FileEntry.h.

Member Function Documentation

◆ closeFile()

void clang::FileEntryRef::closeFile ( ) const
inline

Definition at line 430 of file FileEntry.h.

◆ getBaseMapEntry()

const MapEntry& clang::FileEntryRef::getBaseMapEntry ( ) const
inline

Retrieve the base MapEntry after redirects.

Definition at line 172 of file FileEntry.h.

◆ getDir()

DirectoryEntryRef clang::FileEntryRef::getDir ( ) const
inline

Definition at line 78 of file FileEntry.h.

◆ getFileEntry()

const FileEntry& clang::FileEntryRef::getFileEntry ( ) const
inline

◆ getMapEntry()

const clang::FileEntryRef::MapEntry& clang::FileEntryRef::getMapEntry ( ) const
inline

Expose the underlying MapEntry to simplify packing in a PointerIntPair or PointerUnion and allow construction in Optional.

Definition at line 169 of file FileEntry.h.

◆ getModificationTime()

time_t clang::FileEntryRef::getModificationTime ( ) const
inline

Definition at line 424 of file FileEntry.h.

◆ getName()

StringRef clang::FileEntryRef::getName ( ) const
inline

The name of this FileEntry.

If a VFS uses 'use-external-name', this is the redirected name. See getRequestedName().

Definition at line 66 of file FileEntry.h.

Referenced by clang::FrontendAction::BeginSourceFile(), and clang::SourceManager::createFileID().

◆ getNameAsRequested()

StringRef clang::FileEntryRef::getNameAsRequested ( ) const
inline

The name of this FileEntry, as originally requested without applying any remappings for VFS 'use-external-name'.

FIXME: this should be the semantics of getName(). See comment in FileManager::getFileRef().

Definition at line 73 of file FileEntry.h.

◆ getSize()

off_t clang::FileEntryRef::getSize ( ) const
inline

Definition at line 416 of file FileEntry.h.

Referenced by clang::SourceManager::overrideFileContents().

◆ getUID()

unsigned clang::FileEntryRef::getUID ( ) const
inline

Definition at line 418 of file FileEntry.h.

◆ getUniqueID()

const llvm::sys::fs::UniqueID & clang::FileEntryRef::getUniqueID ( ) const
inline

Definition at line 420 of file FileEntry.h.

◆ isNamedPipe()

bool clang::FileEntryRef::isNamedPipe ( ) const
inline

Definition at line 428 of file FileEntry.h.

◆ isSameRef()

bool clang::FileEntryRef::isSameRef ( const FileEntryRef RHS) const
inline

Check if RHS referenced the file in exactly the same way.

Definition at line 140 of file FileEntry.h.

Referenced by llvm::DenseMapInfo< clang::FileEntryRef >::isEqual().

◆ operator const FileEntry *()

clang::FileEntryRef::operator const FileEntry * ( ) const
inline

Allow FileEntryRef to degrade into 'const FileEntry*' to facilitate incremental adoption.

The goal is to avoid code churn due to dances like the following:

// Old code.
lvalue = rvalue;
// Temporary code from an incremental patch.
lvalue = &rvalue.getFileEntry();
// Final code.
lvalue = rvalue;

FIXME: Once FileEntryRef is "everywhere" and FileEntry::LastRef and FileEntry::getName have been deleted, delete this implicit conversion.

Definition at line 159 of file FileEntry.h.

Friends And Related Function Documentation

◆ FileMgr::MapEntryOptionalStorage< FileEntryRef >

Definition at line 180 of file FileEntry.h.

◆ hash_value

llvm::hash_code hash_value ( FileEntryRef  Ref)
friend

Hash code is based on the FileEntry, not the specific named reference, just like operator==.

Definition at line 110 of file FileEntry.h.

◆ llvm::DenseMapInfo< FileEntryRef >

friend struct llvm::DenseMapInfo< FileEntryRef >
friend

Definition at line 187 of file FileEntry.h.

◆ operator!= [1/3]

bool operator!= ( const FileEntry LHS,
const FileEntryRef RHS 
)
friend

Definition at line 101 of file FileEntry.h.

◆ operator!= [2/3]

bool operator!= ( const FileEntryRef LHS,
const FileEntry RHS 
)
friend

Definition at line 104 of file FileEntry.h.

◆ operator!= [3/3]

bool operator!= ( const FileEntryRef LHS,
const FileEntryRef RHS 
)
friend

Definition at line 98 of file FileEntry.h.

◆ operator== [1/3]

bool operator== ( const FileEntry LHS,
const FileEntryRef RHS 
)
friend

Definition at line 92 of file FileEntry.h.

◆ operator== [2/3]

bool operator== ( const FileEntryRef LHS,
const FileEntry RHS 
)
friend

Definition at line 95 of file FileEntry.h.

◆ operator== [3/3]

bool operator== ( const FileEntryRef LHS,
const FileEntryRef RHS 
)
friend

Check if the underlying FileEntry is the same, intentially ignoring whether the file was referenced with the same spelling of the filename.

Definition at line 89 of file FileEntry.h.


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