Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -3843,4 +3843,25 @@ typename clang::LazyGenerationalUpdatePtr<Owner, T, Update>::ValueType
return Value;
}

template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }

static FoldingSetNodeID getTombstoneKey() {
FoldingSetNodeID ID;
for (size_t I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) {
ID.AddInteger(std::numeric_limits<unsigned>::max());
}
return ID;
Comment on lines +3850 to +3854
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to say ID can probably be static (constexpr if possible?)...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

static unsigned getHashValue(const FoldingSetNodeID &Val) {
return Val.ComputeHash();
}

static bool isEqual(const FoldingSetNodeID &LHS,
const FoldingSetNodeID &RHS) {
return LHS == RHS;
}
};

#endif // LLVM_CLANG_AST_ASTCONTEXT_H
21 changes: 0 additions & 21 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,6 @@ enum FloatingRank {
Ibm128Rank
};

template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {
static FoldingSetNodeID getEmptyKey() { return FoldingSetNodeID{}; }

static FoldingSetNodeID getTombstoneKey() {
FoldingSetNodeID id;
for (size_t i = 0; i < sizeof(id) / sizeof(unsigned); ++i) {
id.AddInteger(std::numeric_limits<unsigned>::max());
}
return id;
}

static unsigned getHashValue(const FoldingSetNodeID &Val) {
return Val.ComputeHash();
}

static bool isEqual(const FoldingSetNodeID &LHS,
const FoldingSetNodeID &RHS) {
return LHS == RHS;
}
};

/// \returns The locations that are relevant when searching for Doc comments
/// related to \p D.
static SmallVector<SourceLocation, 2>
Expand Down
27 changes: 0 additions & 27 deletions clang/lib/Sema/SemaConcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1864,33 +1864,6 @@ NormalizedConstraint::getFoldExpandedConstraint() const {
// ------------------------ Subsumption -----------------------------------
//
//

template <> struct llvm::DenseMapInfo<llvm::FoldingSetNodeID> {

static FoldingSetNodeID getEmptyKey() {
FoldingSetNodeID ID;
ID.AddInteger(std::numeric_limits<unsigned>::max());
return ID;
}

static FoldingSetNodeID getTombstoneKey() {
FoldingSetNodeID ID;
for (unsigned I = 0; I < sizeof(ID) / sizeof(unsigned); ++I) {
ID.AddInteger(std::numeric_limits<unsigned>::max());
}
return ID;
}

static unsigned getHashValue(const FoldingSetNodeID &Val) {
return Val.ComputeHash();
}

static bool isEqual(const FoldingSetNodeID &LHS,
const FoldingSetNodeID &RHS) {
return LHS == RHS;
}
};

SubsumptionChecker::SubsumptionChecker(Sema &SemaRef,
SubsumptionCallable Callable)
: SemaRef(SemaRef), Callable(Callable), NextID(1) {}
Expand Down