14#ifndef LLVM_CLANG_BASIC_DIRECTORYENTRY_H
15#define LLVM_CLANG_BASIC_DIRECTORYENTRY_H
19#include "llvm/ADT/DenseMapInfo.h"
20#include "llvm/ADT/Hashing.h"
21#include "llvm/ADT/STLExtras.h"
22#include "llvm/ADT/StringMap.h"
23#include "llvm/ADT/StringRef.h"
24#include "llvm/Support/ErrorOr.h"
39 DirectoryEntry() =
default;
40 DirectoryEntry(
const DirectoryEntry &) =
delete;
41 DirectoryEntry &operator=(
const DirectoryEntry &) =
delete;
52 StringRef
getName()
const {
return ME->getKey(); }
60 using MapEntry = llvm::StringMapEntry<llvm::ErrorOr<DirectoryEntry &>>;
91 struct optional_none_tag {};
95 bool hasOptionalValue()
const {
return ME; }
98 struct dense_map_empty_tag {};
99 struct dense_map_tombstone_tag {};
103 : ME(llvm::DenseMapInfo<const
MapEntry *>::getEmptyKey()) {}
105 : ME(llvm::DenseMapInfo<const
MapEntry *>::getTombstoneKey()) {}
106 bool isSpecialDenseMapKey()
const {
121 using optional_none_tag =
typename RefTy::optional_none_tag;
122 RefTy MaybeRef = optional_none_tag();
127 template <
class... ArgTypes>
129 : MaybeRef(
std::
forward<ArgTypes>(Args)...) {}
131 void reset() { MaybeRef = optional_none_tag(); }
133 bool has_value()
const {
return MaybeRef.hasOptionalValue(); }
145 return std::move(MaybeRef);
148 template <
class... Args>
void emplace(Args &&...args) {
149 MaybeRef = RefTy(std::forward<Args>(args)...);
160namespace optional_detail {
171 using StorageImpl::StorageImpl;
180 "OptionalDirectoryEntryRef must avoid size overhead");
182static_assert(std::is_trivially_copyable<OptionalDirectoryEntryRef>::value,
183 "OptionalDirectoryEntryRef should be trivially copyable");
205template <>
struct DenseMapInfo<
clang::DirectoryEntryRef> {
208 clang::DirectoryEntryRef::dense_map_empty_tag());
213 clang::DirectoryEntryRef::dense_map_tombstone_tag());
227 if (LHS.isSpecialDenseMapKey() || RHS.isSpecialDenseMapKey())
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
A reference to a DirectoryEntry that includes the name of the directory as it was accessed by the Fil...
StringRef getName() const
DirectoryEntryRef(const MapEntry &ME)
DirectoryEntryRef()=delete
friend llvm::hash_code hash_value(DirectoryEntryRef Ref)
Hash code is based on the DirectoryEntry, not the specific named reference.
bool isSameRef(DirectoryEntryRef RHS) const
Check if RHS referenced the file in exactly the same way.
const MapEntry & getMapEntry() const
llvm::StringMapEntry< llvm::ErrorOr< DirectoryEntry & > > MapEntry
const DirectoryEntry & getDirEntry() const
Cached information about one directory (either on disk or in the virtual file system).
friend class FileEntryTestHelper
Customized storage for refs derived from map entires in FileManager, using the private optional_none_...
MapEntryOptionalStorage()=default
MapEntryOptionalStorage(std::in_place_t, ArgTypes &&...Args)
void emplace(Args &&...args)
MapEntryOptionalStorage & operator=(RefTy Ref)
RefTy const & value() const &
OptionalStorage & operator=(clang::DirectoryEntryRef Ref)
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
CustomizableOptional< DirectoryEntryRef > OptionalDirectoryEntryRef
Diagnostic wrappers for TextAPI types for error reporting.
hash_code hash_value(const clang::tooling::dependencies::ModuleID &ID)
static clang::DirectoryEntryRef getTombstoneKey()
static clang::DirectoryEntryRef getEmptyKey()
static unsigned getHashValue(clang::DirectoryEntryRef Val)
static bool isEqual(clang::DirectoryEntryRef LHS, clang::DirectoryEntryRef RHS)
static constexpr int NumLowBitsAvailable
static clang::DirectoryEntryRef getFromVoidPointer(void *Ptr)
static void * getAsVoidPointer(clang::DirectoryEntryRef Dir)