clang  14.0.0git
Public Member Functions | List of all members
clang::OptionalFileEntryRefDegradesToFileEntryPtr Class Reference

Wrapper around Optional<FileEntryRef> that degrades to 'const FileEntry*', facilitating incremental patches to propagate FileEntryRef. More...

#include "clang/Basic/FileEntry.h"

Inheritance diagram for clang::OptionalFileEntryRefDegradesToFileEntryPtr:
Inheritance graph
[legend]
Collaboration diagram for clang::OptionalFileEntryRefDegradesToFileEntryPtr:
Collaboration graph
[legend]

Public Member Functions

 OptionalFileEntryRefDegradesToFileEntryPtr ()=default
 
 OptionalFileEntryRefDegradesToFileEntryPtr (OptionalFileEntryRefDegradesToFileEntryPtr &&)=default
 
 OptionalFileEntryRefDegradesToFileEntryPtr (const OptionalFileEntryRefDegradesToFileEntryPtr &)=default
 
OptionalFileEntryRefDegradesToFileEntryPtroperator= (OptionalFileEntryRefDegradesToFileEntryPtr &&)=default
 
OptionalFileEntryRefDegradesToFileEntryPtroperator= (const OptionalFileEntryRefDegradesToFileEntryPtr &)=default
 
 OptionalFileEntryRefDegradesToFileEntryPtr (llvm::NoneType)
 
 OptionalFileEntryRefDegradesToFileEntryPtr (FileEntryRef Ref)
 
 OptionalFileEntryRefDegradesToFileEntryPtr (Optional< FileEntryRef > MaybeRef)
 
OptionalFileEntryRefDegradesToFileEntryPtroperator= (llvm::NoneType)
 
OptionalFileEntryRefDegradesToFileEntryPtroperator= (FileEntryRef Ref)
 
OptionalFileEntryRefDegradesToFileEntryPtroperator= (Optional< FileEntryRef > MaybeRef)
 
 operator const FileEntry * () const
 Degrade to 'const FileEntry *' to allow FileEntry::LastRef and FileEntry::getName have been deleted, delete this class and replace instances with Optional<FileEntryRef> More...
 

Detailed Description

Wrapper around Optional<FileEntryRef> that degrades to 'const FileEntry*', facilitating incremental patches to propagate FileEntryRef.

This class can be used as return value or field where it's convenient for an Optional<FileEntryRef> to degrade to a 'const FileEntry*'. The purpose is to avoid code churn due to dances like the following:

// Old code.
lvalue = rvalue;
// Temporary code from an incremental patch.
Optional<FileEntryRef> MaybeF = rvalue;
lvalue = MaybeF ? &MaybeF.getFileEntry() : nullptr;
// Final code.
lvalue = rvalue;

FIXME: Once FileEntryRef is "everywhere" and FileEntry::LastRef and FileEntry::getName have been deleted, delete this class and replace instances with Optional<FileEntryRef>.

Definition at line 280 of file FileEntry.h.

Constructor & Destructor Documentation

◆ OptionalFileEntryRefDegradesToFileEntryPtr() [1/6]

clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr ( )
default

◆ OptionalFileEntryRefDegradesToFileEntryPtr() [2/6]

clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr ( OptionalFileEntryRefDegradesToFileEntryPtr &&  )
default

◆ OptionalFileEntryRefDegradesToFileEntryPtr() [3/6]

clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr ( const OptionalFileEntryRefDegradesToFileEntryPtr )
default

◆ OptionalFileEntryRefDegradesToFileEntryPtr() [4/6]

clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr ( llvm::NoneType  )
inline

Definition at line 293 of file FileEntry.h.

◆ OptionalFileEntryRefDegradesToFileEntryPtr() [5/6]

clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr ( FileEntryRef  Ref)
inline

Definition at line 294 of file FileEntry.h.

◆ OptionalFileEntryRefDegradesToFileEntryPtr() [6/6]

clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr ( Optional< FileEntryRef MaybeRef)
inline

Definition at line 296 of file FileEntry.h.

Member Function Documentation

◆ operator const FileEntry *()

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

Degrade to 'const FileEntry *' to allow FileEntry::LastRef and FileEntry::getName have been deleted, delete this class and replace instances with Optional<FileEntryRef>

Definition at line 316 of file FileEntry.h.

References getValue().

◆ operator=() [1/5]

OptionalFileEntryRefDegradesToFileEntryPtr& clang::OptionalFileEntryRefDegradesToFileEntryPtr::operator= ( const OptionalFileEntryRefDegradesToFileEntryPtr )
default

◆ operator=() [2/5]

OptionalFileEntryRefDegradesToFileEntryPtr& clang::OptionalFileEntryRefDegradesToFileEntryPtr::operator= ( FileEntryRef  Ref)
inline

Definition at line 303 of file FileEntry.h.

◆ operator=() [3/5]

OptionalFileEntryRefDegradesToFileEntryPtr& clang::OptionalFileEntryRefDegradesToFileEntryPtr::operator= ( llvm::NoneType  )
inline

Definition at line 299 of file FileEntry.h.

◆ operator=() [4/5]

OptionalFileEntryRefDegradesToFileEntryPtr& clang::OptionalFileEntryRefDegradesToFileEntryPtr::operator= ( Optional< FileEntryRef MaybeRef)
inline

Definition at line 308 of file FileEntry.h.

◆ operator=() [5/5]

OptionalFileEntryRefDegradesToFileEntryPtr& clang::OptionalFileEntryRefDegradesToFileEntryPtr::operator= ( OptionalFileEntryRefDegradesToFileEntryPtr &&  )
default

The documentation for this class was generated from the following file:
llvm::Optional
Definition: LLVM.h:40