[all-commits] [llvm/llvm-project] 21da04: [llvm, clang] Remove stdlib includes from .h files...

Nico Weber via All-commits all-commits at lists.llvm.org
Tue Apr 27 09:42:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 21da04f701735ecd42f1d43b3f58b708ad382905
      https://github.com/llvm/llvm-project/commit/21da04f701735ecd42f1d43b3f58b708ad382905
  Author: Nico Weber <thakis at chromium.org>
  Date:   2021-04-27 (Tue, 27 Apr 2021)

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

  Log Message:
  -----------
  [llvm, clang] Remove stdlib includes from .h files without `std::`

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




More information about the All-commits mailing list