Index: clang/include/clang/AST/ComparisonCategories.h =================================================================== --- clang/include/clang/AST/ComparisonCategories.h +++ clang/include/clang/AST/ComparisonCategories.h @@ -19,6 +19,7 @@ #include "llvm/ADT/DenseMap.h" #include #include +#include namespace llvm { class StringRef; Index: llvm/include/llvm/ADT/ArrayRef.h =================================================================== --- llvm/include/llvm/ADT/ArrayRef.h +++ llvm/include/llvm/ADT/ArrayRef.h @@ -26,6 +26,8 @@ namespace llvm { + template struct DenseMapInfo; + /// ArrayRef - Represent a constant reference to an array (0 or more elements /// consecutively in memory), i.e. a start pointer and a length. It allows /// various APIs to take consecutive elements easily and conveniently. @@ -569,6 +571,35 @@ return hash_combine_range(S.begin(), S.end()); } + // Provide DenseMapInfo for ArrayRefs. + template struct DenseMapInfo> { + static inline ArrayRef getEmptyKey() { + return ArrayRef( + reinterpret_cast(~static_cast(0)), size_t(0)); + } + + static inline ArrayRef getTombstoneKey() { + return ArrayRef( + reinterpret_cast(~static_cast(1)), size_t(0)); + } + + static unsigned getHashValue(ArrayRef 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)); + } + + static bool isEqual(ArrayRef LHS, ArrayRef RHS) { + if (RHS.data() == getEmptyKey().data()) + return LHS.data() == getEmptyKey().data(); + if (RHS.data() == getTombstoneKey().data()) + return LHS.data() == getTombstoneKey().data(); + return LHS == RHS; + } + }; + } // end namespace llvm #endif // LLVM_ADT_ARRAYREF_H Index: llvm/include/llvm/ADT/DenseMapInfo.h =================================================================== --- llvm/include/llvm/ADT/DenseMapInfo.h +++ llvm/include/llvm/ADT/DenseMapInfo.h @@ -13,9 +13,7 @@ #ifndef LLVM_ADT_DENSEMAPINFO_H #define LLVM_ADT_DENSEMAPINFO_H -#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Hashing.h" -#include "llvm/ADT/StringRef.h" #include #include #include @@ -284,62 +282,6 @@ } }; -// Provide DenseMapInfo for StringRefs. -template <> struct DenseMapInfo { - static inline StringRef getEmptyKey() { - return StringRef(reinterpret_cast(~static_cast(0)), - 0); - } - - static inline StringRef getTombstoneKey() { - return StringRef(reinterpret_cast(~static_cast(1)), - 0); - } - - static unsigned 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)); - } - - static bool isEqual(StringRef LHS, StringRef RHS) { - if (RHS.data() == getEmptyKey().data()) - return LHS.data() == getEmptyKey().data(); - if (RHS.data() == getTombstoneKey().data()) - return LHS.data() == getTombstoneKey().data(); - return LHS == RHS; - } -}; - -// Provide DenseMapInfo for ArrayRefs. -template struct DenseMapInfo> { - static inline ArrayRef getEmptyKey() { - return ArrayRef(reinterpret_cast(~static_cast(0)), - size_t(0)); - } - - static inline ArrayRef getTombstoneKey() { - return ArrayRef(reinterpret_cast(~static_cast(1)), - size_t(0)); - } - - static unsigned getHashValue(ArrayRef 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)); - } - - static bool isEqual(ArrayRef LHS, ArrayRef RHS) { - if (RHS.data() == getEmptyKey().data()) - return LHS.data() == getEmptyKey().data(); - if (RHS.data() == getTombstoneKey().data()) - return LHS.data() == getTombstoneKey().data(); - return LHS == RHS; - } -}; - template <> struct DenseMapInfo { static inline hash_code getEmptyKey() { return hash_code(-1); } static inline hash_code getTombstoneKey() { return hash_code(-2); } Index: llvm/include/llvm/ADT/StringRef.h =================================================================== --- llvm/include/llvm/ADT/StringRef.h +++ llvm/include/llvm/ADT/StringRef.h @@ -35,6 +35,7 @@ class APInt; class hash_code; template class SmallVectorImpl; + template struct DenseMapInfo; class StringRef; /// Helper functions for StringRef::getAsInteger. @@ -925,6 +926,35 @@ LLVM_NODISCARD hash_code hash_value(StringRef S); + // Provide DenseMapInfo for StringRefs. + template <> struct DenseMapInfo { + static inline StringRef getEmptyKey() { + return StringRef( + reinterpret_cast(~static_cast(0)), 0); + } + + static inline StringRef getTombstoneKey() { + return StringRef( + reinterpret_cast(~static_cast(1)), 0); + } + + static unsigned 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)); + } + + static bool isEqual(StringRef LHS, StringRef RHS) { + if (RHS.data() == getEmptyKey().data()) + return LHS.data() == getEmptyKey().data(); + if (RHS.data() == getTombstoneKey().data()) + return LHS.data() == getTombstoneKey().data(); + return LHS == RHS; + } + }; + } // end namespace llvm #endif // LLVM_ADT_STRINGREF_H Index: llvm/include/llvm/IR/PassInstrumentation.h =================================================================== --- llvm/include/llvm/IR/PassInstrumentation.h +++ llvm/include/llvm/IR/PassInstrumentation.h @@ -53,6 +53,7 @@ #include "llvm/ADT/FunctionExtras.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" +#include #include namespace llvm { Index: llvm/include/llvm/Support/Threading.h =================================================================== --- llvm/include/llvm/Support/Threading.h +++ llvm/include/llvm/Support/Threading.h @@ -17,6 +17,7 @@ #include "llvm/ADT/BitVector.h" #include "llvm/ADT/FunctionExtras.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX #include "llvm/Support/Compiler.h" #include // So we can check the C++ standard lib macros. Index: llvm/lib/CodeGen/AsmPrinter/WinException.h =================================================================== --- llvm/lib/CodeGen/AsmPrinter/WinException.h +++ llvm/lib/CodeGen/AsmPrinter/WinException.h @@ -14,6 +14,7 @@ #define LLVM_LIB_CODEGEN_ASMPRINTER_WIN64EXCEPTION_H #include "EHStreamer.h" +#include namespace llvm { class GlobalValue; Index: llvm/lib/CodeGen/MBFIWrapper.cpp =================================================================== --- llvm/lib/CodeGen/MBFIWrapper.cpp +++ llvm/lib/CodeGen/MBFIWrapper.cpp @@ -11,6 +11,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/Optional.h" #include "llvm/CodeGen/MBFIWrapper.h" #include "llvm/CodeGen/MachineBlockFrequencyInfo.h" Index: llvm/lib/MC/StringTableBuilder.cpp =================================================================== --- llvm/lib/MC/StringTableBuilder.cpp +++ llvm/lib/MC/StringTableBuilder.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "llvm/MC/StringTableBuilder.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringRef.h" Index: llvm/lib/Support/SmallPtrSet.cpp =================================================================== --- llvm/lib/Support/SmallPtrSet.cpp +++ llvm/lib/Support/SmallPtrSet.cpp @@ -14,6 +14,7 @@ #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/MemAlloc.h" #include "llvm/Support/ErrorHandling.h" #include #include Index: llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.h =================================================================== --- llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.h +++ llvm/lib/Target/AMDGPU/AMDGPUGlobalISelUtils.h @@ -9,6 +9,7 @@ #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUGLOBALISELUTILS_H #define LLVM_LIB_TARGET_AMDGPU_AMDGPUGLOBALISELUTILS_H +#include "llvm/ADT/ArrayRef.h" #include "llvm/CodeGen/Register.h" #include Index: llvm/tools/llvm-c-test/echo.cpp =================================================================== --- llvm/tools/llvm-c-test/echo.cpp +++ llvm/tools/llvm-c-test/echo.cpp @@ -18,6 +18,7 @@ #include "llvm-c/DebugInfo.h" #include "llvm-c/Target.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/ErrorHandling.h" #include Index: mlir/include/mlir/IR/AffineExpr.h =================================================================== --- mlir/include/mlir/IR/AffineExpr.h +++ mlir/include/mlir/IR/AffineExpr.h @@ -17,6 +17,7 @@ #include "mlir/Support/LLVM.h" #include "llvm/ADT/DenseMapInfo.h" #include "llvm/Support/Casting.h" +#include #include namespace mlir { Index: mlir/include/mlir/IR/DialectInterface.h =================================================================== --- mlir/include/mlir/IR/DialectInterface.h +++ mlir/include/mlir/IR/DialectInterface.h @@ -11,6 +11,7 @@ #include "mlir/Support/TypeID.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/STLExtras.h" namespace mlir { class Dialect; Index: mlir/include/mlir/Support/InterfaceSupport.h =================================================================== --- mlir/include/mlir/Support/InterfaceSupport.h +++ mlir/include/mlir/Support/InterfaceSupport.h @@ -14,6 +14,7 @@ #define MLIR_SUPPORT_INTERFACESUPPORT_H #include "mlir/Support/TypeID.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/Support/TypeName.h" Index: mlir/include/mlir/Support/StorageUniquer.h =================================================================== --- mlir/include/mlir/Support/StorageUniquer.h +++ mlir/include/mlir/Support/StorageUniquer.h @@ -12,7 +12,9 @@ #include "mlir/Support/LLVM.h" #include "mlir/Support/LogicalResult.h" #include "mlir/Support/TypeID.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/Allocator.h" namespace mlir {