[llvm, clang] Remove stdlib includes from .h files without `std::`
authorNico Weber <thakis@chromium.org>
Tue, 27 Apr 2021 16:31:09 +0000 (12:31 -0400)
committerNico Weber <thakis@chromium.org>
Tue, 27 Apr 2021 16:41:39 +0000 (12:41 -0400)
Found files not containing `std::` with:

    INCL="algorithm|array|list|map|memory|queue|set|string|utility|vector|unordered_map|unordered_set"
    git ls-files llvm/include/llvm | grep '\.h$' | xargs grep -L std:: | \
        xargs grep -El "#include <($INCL)>$" > to_process.txt
    git ls-files clang/include/clang | grep '\.h$' | xargs grep -L std:: | \
        xargs grep -El "#include <($INCL)>$" >> to_process.txt

Then removed these headers from those files with

    INCL_ESCAPED="$(echo $INCL|sed 's/|/\\|/g')"
    cat to_process.txt | xargs sed -i "/^#include <\($INCL_ESCAPED\)>$/d"
    cat to_process.txt | xargs sed -i '/^$/N;/^\n$/D'

No behavior change.

Differential Revision: https://reviews.llvm.org/D101378

17 files changed:
clang/include/clang/AST/DeclContextInternals.h
clang/include/clang/Driver/Options.h
clang/include/clang/Index/CommentToXML.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h
clang/include/clang/Tooling/Refactoring/RefactoringActionRule.h
clang/include/clang/Tooling/Transformer/Parsing.h
llvm/include/llvm/CodeGen/MachineInstrBuilder.h
llvm/include/llvm/CodeGen/TileShapeInfo.h
llvm/include/llvm/DebugInfo/CodeView/AppendingTypeTableBuilder.h
llvm/include/llvm/DebugInfo/CodeView/GlobalTypeTableBuilder.h
llvm/include/llvm/DebugInfo/CodeView/MergingTypeTableBuilder.h
llvm/include/llvm/DebugInfo/GSYM/FileEntry.h
llvm/include/llvm/DebugInfo/GSYM/StringTable.h
llvm/include/llvm/ExecutionEngine/Orc/OrcABISupport.h
llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h
llvm/include/llvm/Target/CGPassBuilderOption.h
llvm/include/llvm/Transforms/Scalar/SpeculateAroundPHIs.h

index 3556044..2eef234 100644 (file)
@@ -22,7 +22,6 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/PointerIntPair.h"
 #include "llvm/ADT/PointerUnion.h"
-#include <algorithm>
 #include <cassert>
 
 namespace clang {
index b641f64..0566601 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef LLVM_CLANG_DRIVER_OPTIONS_H
 #define LLVM_CLANG_DRIVER_OPTIONS_H
 
-#include <memory>
-
 namespace llvm {
 namespace opt {
 class OptTable;
index 66b8650..29904f1 100644 (file)
@@ -10,7 +10,6 @@
 #define LLVM_CLANG_INDEX_COMMENTTOXML_H
 
 #include "clang/Basic/LLVM.h"
-#include <memory>
 
 namespace clang {
 class ASTContext;
index 2679339..ffe1fe8 100644 (file)
@@ -24,7 +24,6 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
 #include "llvm/ADT/ImmutableMap.h"
 #include "llvm/ADT/Optional.h"
-#include <utility>
 
 namespace clang {
 namespace ento {
index 0c6e38a..57dffa9 100644 (file)
@@ -12,7 +12,6 @@
 #include "clang/Basic/LLVM.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
-#include <vector>
 
 namespace clang {
 namespace tooling {
index 8e51f59..b143f63 100644 (file)
@@ -21,7 +21,6 @@
 #include "clang/Tooling/Transformer/RangeSelector.h"
 #include "llvm/Support/Error.h"
 #include <functional>
-#include <string>
 
 namespace clang {
 namespace transformer {
index 5a6f688..80f3023 100644 (file)
@@ -31,7 +31,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include <cassert>
 #include <cstdint>
-#include <utility>
 
 namespace llvm {
 
index 031d235..4e574bd 100644 (file)
@@ -24,7 +24,6 @@
 #include "llvm/CodeGen/MachineOperand.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/Register.h"
-#include <utility>
 
 namespace llvm {
 
index 55b9535..5a91682 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/Support/Allocator.h"
 #include <cstdint>
-#include <memory>
 
 namespace llvm {
 namespace codeview {
index 9d79140..465c26e 100644 (file)
@@ -20,7 +20,6 @@
 #include "llvm/Support/Allocator.h"
 #include <cassert>
 #include <cstdint>
-#include <memory>
 
 namespace llvm {
 namespace codeview {
index 40ac25c..0f9d5e4 100644 (file)
@@ -19,7 +19,6 @@
 #include "llvm/DebugInfo/CodeView/TypeIndex.h"
 #include "llvm/Support/Allocator.h"
 #include <cstdint>
-#include <memory>
 
 namespace llvm {
 namespace codeview {
index 538f676..8e00c5f 100644 (file)
@@ -13,7 +13,6 @@
 #include "llvm/ADT/Hashing.h"
 #include <functional>
 #include <stdint.h>
-#include <utility>
 
 namespace llvm {
 namespace gsym {
index 3c0c654..f7f800d 100644 (file)
@@ -13,8 +13,6 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/DebugInfo/GSYM/Range.h"
 #include <stdint.h>
-#include <string>
-
 
 namespace llvm {
 namespace gsym {
index 5061c15..82dfdc2 100644 (file)
@@ -21,7 +21,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
-#include <algorithm>
 #include <cstdint>
 
 namespace llvm {
index 811c50e..14d30c4 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
 #include "llvm/Support/Error.h"
-#include <vector>
 
 namespace llvm {
 namespace orc {
index 09001d7..11b904e 100644 (file)
@@ -17,7 +17,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Target/TargetOptions.h"
-#include <vector>
 
 namespace llvm {
 class TargetMachine;
index 3c7dafe..2104daf 100644 (file)
@@ -15,7 +15,6 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/Compiler.h"
-#include <vector>
 
 namespace llvm {