diff options
author | serge-sans-paille <sguelton@redhat.com> | 2022-01-24 05:57:09 -0500 |
---|---|---|
committer | serge-sans-paille <sguelton@redhat.com> | 2022-01-24 14:13:21 +0100 |
commit | 5f290c090a2404238a5b0ae4233f3ae9daec319e (patch) | |
tree | c29df3e136bf41f1148b15fef94b46ab2c4eb557 /llvm/lib/Support/StringRef.cpp | |
parent | b2a8eff45c55fe7fe05cb94c5a8525b54511a33e (diff) | |
download | llvm-5f290c090a2404238a5b0ae4233f3ae9daec319e.zip llvm-5f290c090a2404238a5b0ae4233f3ae9daec319e.tar.gz llvm-5f290c090a2404238a5b0ae4233f3ae9daec319e.tar.bz2 |
Move STLFunctionalExtras out of STLExtras
Only using that change in StringRef already decreases the number of
preoprocessed lines from 7837621 to 7776151 for LLVMSupport
Perhaps more interestingly, it shows that many files were relying on the
inclusion of StringRef.h to have the declaration from STLExtras.h. This
patch tries hard to patch relevant part of llvm-project impacted by this
hidden dependency removal.
Potential impact:
- "llvm/ADT/StringRef.h" no longer includes <memory>,
"llvm/ADT/Optional.h" nor "llvm/ADT/STLExtras.h"
Related Discourse thread:
https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
Diffstat (limited to 'llvm/lib/Support/StringRef.cpp')
-rw-r--r-- | llvm/lib/Support/StringRef.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp index 652303f..3ed08ed 100644 --- a/llvm/lib/Support/StringRef.cpp +++ b/llvm/lib/Support/StringRef.cpp @@ -597,3 +597,11 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const { hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S.begin(), S.end()); } + +unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) { + assert(Val.data() != getEmptyKey().data() && + "Cannot hash the empty key!"); + assert(Val.data() != getTombstoneKey().data() && + "Cannot hash the tombstone key!"); + return (unsigned)(hash_value(Val)); +} |