File indexing completed on 2026-05-10 08:37:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_CLANG_SEMA_WEAK_H
0015 #define LLVM_CLANG_SEMA_WEAK_H
0016
0017 #include "clang/Basic/SourceLocation.h"
0018 #include "llvm/ADT/DenseMapInfo.h"
0019
0020 namespace clang {
0021
0022 class IdentifierInfo;
0023
0024
0025 class WeakInfo {
0026 const IdentifierInfo *alias = nullptr;
0027 SourceLocation loc;
0028 public:
0029 WeakInfo() = default;
0030 WeakInfo(const IdentifierInfo *Alias, SourceLocation Loc)
0031 : alias(Alias), loc(Loc) {}
0032 inline const IdentifierInfo *getAlias() const { return alias; }
0033 inline SourceLocation getLocation() const { return loc; }
0034 bool operator==(WeakInfo RHS) const = delete;
0035 bool operator!=(WeakInfo RHS) const = delete;
0036
0037 struct DenseMapInfoByAliasOnly
0038 : private llvm::DenseMapInfo<const IdentifierInfo *> {
0039 static inline WeakInfo getEmptyKey() {
0040 return WeakInfo(DenseMapInfo::getEmptyKey(), SourceLocation());
0041 }
0042 static inline WeakInfo getTombstoneKey() {
0043 return WeakInfo(DenseMapInfo::getTombstoneKey(), SourceLocation());
0044 }
0045 static unsigned getHashValue(const WeakInfo &W) {
0046 return DenseMapInfo::getHashValue(W.getAlias());
0047 }
0048 static bool isEqual(const WeakInfo &LHS, const WeakInfo &RHS) {
0049 return DenseMapInfo::isEqual(LHS.getAlias(), RHS.getAlias());
0050 }
0051 };
0052 };
0053
0054 }
0055
0056 #endif