[PATCH] D101378: [llvm, clang] Remove stdlib includes from .h files without `std::`

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 09:34:01 PDT 2021


thakis created this revision.
thakis added a reviewer: hans.
Herald added a subscriber: arphaman.
thakis requested review of this revision.
Herald added a project: LLVM.

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.


https://reviews.llvm.org/D101378

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101378.340880.patch
Type: text/x-patch
Size: 7111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210427/fd3a140e/attachment.bin>


More information about the llvm-commits mailing list