[ADT] Fix IWYU for hashing-adjacent files (#194297)

Add explicit includes so these files keep building after we trim
transitive includes from xxhash.h.

For example, FoldingSet.cpp calls llvm::uninitialized_copy, which is
declared in llvm/ADT/STLExtras.h and today reaches the file only
transitively.

Also drop the vestigial `#include "llvm/ADT/Hashing.h"` from
llvm/ADT/STLExtras.h — no name from Hashing.h is used there.
This commit is contained in:
Fangrui Song
2026-04-27 01:45:25 -07:00
committed by GitHub
parent 2c39855fb7
commit 6b25ae4fed
8 changed files with 7 additions and 1 deletions

View File

@@ -26,6 +26,7 @@
#include "support/Context.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
#include <functional>

View File

@@ -14,6 +14,7 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/PointerUnion.h"
#include <optional>
#include <string>
namespace clang {
class CXXBaseSpecifier;

View File

@@ -16,6 +16,7 @@
#ifndef LLVM_ADT_FOLDINGSET_H
#define LLVM_ADT_FOLDINGSET_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/SmallVector.h"

View File

@@ -18,7 +18,6 @@
#define LLVM_ADT_STLEXTRAS_H
#include "llvm/ADT/ADL.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/iterator.h"

View File

@@ -18,6 +18,7 @@
#ifndef LLVM_ADT_STABLEHASHING_H
#define LLVM_ADT_STABLEHASHING_H
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/xxhash.h"

View File

@@ -14,6 +14,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/raw_ostream.h"

View File

@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ErrorHandling.h"

View File

@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/xxhash.h"
#include "llvm/ADT/ArrayRef.h"
#include "gtest/gtest.h"
using namespace llvm;