These patches remove unnecessary #includes of STL header files. Found
by grepping for e.g. "#include <vector>" in files that don't mention
std::vector. (And no files should be using "using namespace std",
according to the coding standards.)
Tested with "make all check-all", LLVM and Clang, on my Ubuntu system.
I suppose there is a chance that the headers on my system are a bit
more permissive than they need to be, and I've removed some #includes
that are technically still required, but that seems fairly unlikely to
me.
OK to commit?
I was inspired by:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20110411/119566.html
which showed that pulling in unneeded header files could have a
noticeable effect on build times.
Thanks,
Jay.
Index: include/llvm/Analysis/PathProfileInfo.h
===================================================================
--- include/llvm/Analysis/PathProfileInfo.h (revision 130054)
+++ include/llvm/Analysis/PathProfileInfo.h (working copy)
@@ -16,7 +16,6 @@
#include "llvm/BasicBlock.h"
#include "llvm/Analysis/PathNumbering.h"
-#include <stack>
namespace llvm {
Index: include/llvm/Analysis/AliasAnalysis.h
===================================================================
--- include/llvm/Analysis/AliasAnalysis.h (revision 130054)
+++ include/llvm/Analysis/AliasAnalysis.h (working copy)
@@ -38,7 +38,6 @@
#define LLVM_ANALYSIS_ALIAS_ANALYSIS_H
#include "llvm/Support/CallSite.h"
-#include <vector>
namespace llvm {
Index: include/llvm/Analysis/Lint.h
===================================================================
--- include/llvm/Analysis/Lint.h (revision 130054)
+++ include/llvm/Analysis/Lint.h (working copy)
@@ -20,8 +20,6 @@
#ifndef LLVM_ANALYSIS_LINT_H
#define LLVM_ANALYSIS_LINT_H
-#include <string>
-
namespace llvm {
class FunctionPass;
Index: include/llvm/ADT/StringMap.h
===================================================================
--- include/llvm/ADT/StringMap.h (revision 130054)
+++ include/llvm/ADT/StringMap.h (working copy)
@@ -17,7 +17,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Allocator.h"
#include <cstring>
-#include <string>
namespace llvm {
template<typename ValueT>
Index: include/llvm/ADT/StringExtras.h
===================================================================
--- include/llvm/ADT/StringExtras.h (revision 130054)
+++ include/llvm/ADT/StringExtras.h (working copy)
@@ -20,7 +20,6 @@
#include <cctype>
#include <cstdio>
#include <string>
-#include <vector>
namespace llvm {
template<typename T> class SmallVectorImpl;
Index: include/llvm/MC/MCSection.h
===================================================================
--- include/llvm/MC/MCSection.h (revision 130054)
+++ include/llvm/MC/MCSection.h (working copy)
@@ -14,7 +14,6 @@
#ifndef LLVM_MC_MCSECTION_H
#define LLVM_MC_MCSECTION_H
-#include <string>
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Casting.h"
Index: include/llvm/CodeGen/ScoreboardHazardRecognizer.h
===================================================================
--- include/llvm/CodeGen/ScoreboardHazardRecognizer.h (revision 130054)
+++ include/llvm/CodeGen/ScoreboardHazardRecognizer.h (working copy)
@@ -21,7 +21,6 @@
#include <cassert>
#include <cstring>
-#include <string>
namespace llvm {
Index: include/llvm/CodeGen/PBQP/Heuristics/Briggs.h
===================================================================
--- include/llvm/CodeGen/PBQP/Heuristics/Briggs.h (revision 130054)
+++ include/llvm/CodeGen/PBQP/Heuristics/Briggs.h (working copy)
@@ -21,7 +21,6 @@
#include "../HeuristicSolver.h"
#include "../HeuristicBase.h"
-#include <set>
#include <limits>
namespace PBQP {
Index: include/llvm/CodeGen/PBQP/Graph.h
===================================================================
--- include/llvm/CodeGen/PBQP/Graph.h (revision 130054)
+++ include/llvm/CodeGen/PBQP/Graph.h (working copy)
@@ -18,7 +18,6 @@
#include "Math.h"
#include <list>
-#include <vector>
#include <map>
namespace PBQP {
Index: tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- tools/llvm-objdump/llvm-objdump.cpp (revision 130054)
+++ tools/llvm-objdump/llvm-objdump.cpp (working copy)
@@ -45,7 +45,6 @@
#include <cctype>
#include <cerrno>
#include <cstring>
-#include <vector>
using namespace llvm;
using namespace object;
Index: utils/TableGen/CallingConvEmitter.h
===================================================================
--- utils/TableGen/CallingConvEmitter.h (revision 130054)
+++ utils/TableGen/CallingConvEmitter.h (working copy)
@@ -16,8 +16,6 @@
#define CALLINGCONV_EMITTER_H
#include "TableGenBackend.h"
-#include <map>
-#include <vector>
#include <cassert>
namespace llvm {
Index: utils/TableGen/TGLexer.h
===================================================================
--- utils/TableGen/TGLexer.h (revision 130054)
+++ utils/TableGen/TGLexer.h (working copy)
@@ -15,7 +15,6 @@
#define TGLEXER_H
#include "llvm/Support/DataTypes.h"
-#include <vector>
#include <string>
#include <cassert>
Index: utils/TableGen/DAGISelMatcherOpt.cpp
===================================================================
--- utils/TableGen/DAGISelMatcherOpt.cpp (revision 130054)
+++ utils/TableGen/DAGISelMatcherOpt.cpp (working copy)
@@ -18,7 +18,6 @@
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
-#include <vector>
using namespace llvm;
/// ContractNodes - Turn multiple matcher node patterns like 'MoveChild+Record'
Index: utils/TableGen/ClangDiagnosticsEmitter.cpp
===================================================================
--- utils/TableGen/ClangDiagnosticsEmitter.cpp (revision 130054)
+++ utils/TableGen/ClangDiagnosticsEmitter.cpp (working copy)
@@ -19,7 +19,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/VectorExtras.h"
-#include <set>
#include <map>
#include <algorithm>
#include <functional>
Index: utils/TableGen/EDEmitter.cpp
===================================================================
--- utils/TableGen/EDEmitter.cpp (revision 130054)
+++ utils/TableGen/EDEmitter.cpp (working copy)
@@ -24,7 +24,6 @@
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
-#include <map>
#include <string>
#include <vector>
Index: utils/TableGen/AsmMatcherEmitter.h
===================================================================
--- utils/TableGen/AsmMatcherEmitter.h (revision 130054)
+++ utils/TableGen/AsmMatcherEmitter.h (working copy)
@@ -16,8 +16,6 @@
#define ASMMATCHER_EMITTER_H
#include "TableGenBackend.h"
-#include <map>
-#include <vector>
#include <cassert>
namespace llvm {
Index: utils/TableGen/DAGISelEmitter.h
===================================================================
--- utils/TableGen/DAGISelEmitter.h (revision 130054)
+++ utils/TableGen/DAGISelEmitter.h (working copy)
@@ -16,7 +16,6 @@
#include "TableGenBackend.h"
#include "CodeGenDAGPatterns.h"
-#include <set>
namespace llvm {
Index: utils/TableGen/TGValueTypes.cpp
===================================================================
--- utils/TableGen/TGValueTypes.cpp (revision 130054)
+++ utils/TableGen/TGValueTypes.cpp (working copy)
@@ -16,7 +16,6 @@
#include "llvm/CodeGen/ValueTypes.h"
#include <map>
-#include <vector>
using namespace llvm;
namespace llvm {
Index: lib/Analysis/ProfileInfoLoader.cpp
===================================================================
--- lib/Analysis/ProfileInfoLoader.cpp (revision 130054)
+++ lib/Analysis/ProfileInfoLoader.cpp (working copy)
@@ -19,7 +19,6 @@
#include "llvm/Support/raw_ostream.h"
#include <cstdio>
#include <cstdlib>
-#include <map>
using namespace llvm;
// ByteSwap - Byteswap 'Var' if 'Really' is true.
Index: lib/Analysis/PathNumbering.cpp
===================================================================
--- lib/Analysis/PathNumbering.cpp (revision 130054)
+++ lib/Analysis/PathNumbering.cpp (working copy)
@@ -38,13 +38,10 @@
#include "llvm/Support/TypeBuilder.h"
#include "llvm/Support/raw_ostream.h"
-#include <map>
#include <queue>
-#include <set>
#include <stack>
#include <string>
#include <utility>
-#include <vector>
#include <sstream>
using namespace llvm;
Index: lib/Analysis/LazyValueInfo.cpp
===================================================================
--- lib/Analysis/LazyValueInfo.cpp (revision 130054)
+++ lib/Analysis/LazyValueInfo.cpp (working copy)
@@ -29,7 +29,6 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include <map>
-#include <set>
#include <stack>
using namespace llvm;
Index: lib/Target/XCore/XCoreISelLowering.cpp
===================================================================
--- lib/Target/XCore/XCoreISelLowering.cpp (revision 130054)
+++ lib/Target/XCore/XCoreISelLowering.cpp (working copy)
@@ -37,8 +37,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/VectorExtras.h"
-#include <queue>
-#include <set>
using namespace llvm;
const char *XCoreTargetLowering::
Index: lib/Target/XCore/XCoreISelDAGToDAG.cpp
===================================================================
--- lib/Target/XCore/XCoreISelDAGToDAG.cpp (revision 130054)
+++ lib/Target/XCore/XCoreISelDAGToDAG.cpp (working copy)
@@ -30,8 +30,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
-#include <queue>
-#include <set>
using namespace llvm;
/// XCoreDAGToDAGISel - XCore specific code to select XCore machine
Index: lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
===================================================================
--- lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp (revision 130054)
+++ lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp (working copy)
@@ -27,7 +27,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Mutex.h"
#include <string>
-#include <vector>
namespace llvm {
Index: lib/VMCore/Constants.cpp
===================================================================
--- lib/VMCore/Constants.cpp (revision 130054)
+++ lib/VMCore/Constants.cpp (working copy)
@@ -32,7 +32,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include <algorithm>
-#include <map>
#include <cstdarg>
using namespace llvm;
Index: lib/VMCore/AsmWriter.cpp
===================================================================
--- lib/VMCore/AsmWriter.cpp (revision 130054)
+++ lib/VMCore/AsmWriter.cpp (working copy)
@@ -39,7 +39,6 @@
#include "llvm/Support/FormattedStream.h"
#include <algorithm>
#include <cctype>
-#include <map>
using namespace llvm;
// Make virtual table appear in this compilation unit.
Index: lib/Transforms/Utils/PromoteMemoryToRegister.cpp
===================================================================
--- lib/Transforms/Utils/PromoteMemoryToRegister.cpp (revision 130054)
+++ lib/Transforms/Utils/PromoteMemoryToRegister.cpp (working copy)
@@ -46,7 +46,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
#include <algorithm>
-#include <map>
#include <queue>
using namespace llvm;
Index: lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp (revision 130054)
+++ lib/Transforms/Instrumentation/OptimalEdgeProfiling.cpp (working copy)
@@ -27,7 +27,6 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Statistic.h"
#include "MaximumSpanningTree.h"
-#include <set>
using namespace llvm;
STATISTIC(NumEdgesInserted, "The # of edges inserted.");
Index: lib/Transforms/Instrumentation/PathProfiling.cpp
===================================================================
--- lib/Transforms/Instrumentation/PathProfiling.cpp (revision 130054)
+++ lib/Transforms/Instrumentation/PathProfiling.cpp (working copy)
@@ -63,7 +63,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Instrumentation.h"
-#include <map>
#include <vector>
#define HASH_THRESHHOLD 100000
Index: lib/Transforms/Scalar/DCE.cpp
===================================================================
--- lib/Transforms/Scalar/DCE.cpp (revision 130054)
+++ lib/Transforms/Scalar/DCE.cpp (working copy)
@@ -23,7 +23,6 @@
#include "llvm/Pass.h"
#include "llvm/Support/InstIterator.h"
#include "llvm/ADT/Statistic.h"
-#include <set>
using namespace llvm;
STATISTIC(DIEEliminated, "Number of insts removed by DIE pass");
Index: lib/Transforms/IPO/Inliner.cpp
===================================================================
--- lib/Transforms/IPO/Inliner.cpp (revision 130054)
+++ lib/Transforms/IPO/Inliner.cpp (working copy)
@@ -29,7 +29,6 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/Statistic.h"
-#include <set>
using namespace llvm;
STATISTIC(NumInlined, "Number of functions inlined");
Index: lib/Transforms/IPO/PruneEH.cpp
===================================================================
--- lib/Transforms/IPO/PruneEH.cpp (revision 130054)
+++ lib/Transforms/IPO/PruneEH.cpp (working copy)
@@ -27,7 +27,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/CFG.h"
-#include <set>
#include <algorithm>
using namespace llvm;
Index: lib/MC/MCAssembler.cpp
===================================================================
--- lib/MC/MCAssembler.cpp (revision 130054)
+++ lib/MC/MCAssembler.cpp (working copy)
@@ -28,7 +28,6 @@
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetAsmBackend.h"
-#include <vector>
using namespace llvm;
namespace {
Index: lib/CodeGen/Spiller.cpp
===================================================================
--- lib/CodeGen/Spiller.cpp (revision 130054)
+++ lib/CodeGen/Spiller.cpp (working copy)
@@ -25,7 +25,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
-#include <set>
using namespace llvm;
Index: lib/CodeGen/PHIElimination.cpp
===================================================================
--- lib/CodeGen/PHIElimination.cpp (revision 130054)
+++ lib/CodeGen/PHIElimination.cpp (working copy)
@@ -32,7 +32,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <algorithm>
-#include <map>
using namespace llvm;
static cl::opt<bool>
Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (revision 130054)
+++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (working copy)
@@ -23,7 +23,6 @@
#include "llvm/Support/CallSite.h"
#include "llvm/Support/ErrorHandling.h"
#include <vector>
-#include <set>
namespace llvm {
Index: lib/CodeGen/RegAllocLinearScan.cpp
===================================================================
--- lib/CodeGen/RegAllocLinearScan.cpp (revision 130054)
+++ lib/CodeGen/RegAllocLinearScan.cpp (working copy)
@@ -40,7 +40,6 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
-#include <set>
#include <queue>
#include <memory>
#include <cmath>
Index: include/clang/Frontend/ASTConsumers.h
===================================================================
--- include/clang/Frontend/ASTConsumers.h (revision 130054)
+++ include/clang/Frontend/ASTConsumers.h (working copy)
@@ -14,8 +14,6 @@
#ifndef DRIVER_ASTCONSUMERS_H
#define DRIVER_ASTCONSUMERS_H
-#include <string>
-
namespace llvm {
class raw_ostream;
namespace sys { class Path; }
Index: include/clang/Rewrite/FrontendActions.h
===================================================================
--- include/clang/Rewrite/FrontendActions.h (revision 130054)
+++ include/clang/Rewrite/FrontendActions.h (working copy)
@@ -11,8 +11,6 @@
#define LLVM_CLANG_REWRITE_FRONTENDACTIONS_H
#include "clang/Frontend/FrontendAction.h"
-#include <string>
-#include <vector>
namespace clang {
class FixItRewriter;
Index: include/clang/Rewrite/Rewriter.h
===================================================================
--- include/clang/Rewrite/Rewriter.h (revision 130054)
+++ include/clang/Rewrite/Rewriter.h (working copy)
@@ -22,7 +22,6 @@
#include <cstring>
#include <map>
#include <string>
-#include <vector>
namespace llvm { class raw_ostream; }
Index: include/clang/AST/Expr.h
===================================================================
--- include/clang/AST/Expr.h (revision 130054)
+++ include/clang/AST/Expr.h (working copy)
@@ -27,7 +27,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <cctype>
-#include <vector>
namespace clang {
class ASTContext;
Index: include/clang/Lex/LiteralSupport.h
===================================================================
--- include/clang/Lex/LiteralSupport.h (revision 130054)
+++ include/clang/Lex/LiteralSupport.h (working copy)
@@ -19,7 +19,6 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/DataTypes.h"
#include <cctype>
-#include <string>
namespace clang {
Index: include/clang/Lex/PTHLexer.h
===================================================================
--- include/clang/Lex/PTHLexer.h (revision 130054)
+++ include/clang/Lex/PTHLexer.h (working copy)
@@ -15,7 +15,6 @@
#define LLVM_CLANG_PTHLEXER_H
#include "clang/Lex/PreprocessorLexer.h"
-#include <vector>
namespace clang {
Index: include/clang/Lex/Pragma.h
===================================================================
--- include/clang/Lex/Pragma.h (revision 130054)
+++ include/clang/Lex/Pragma.h (working copy)
@@ -17,7 +17,6 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include <cassert>
-#include <vector>
namespace clang {
class Preprocessor;
Index: include/clang/Lex/MacroInfo.h
===================================================================
--- include/clang/Lex/MacroInfo.h (revision 130054)
+++ include/clang/Lex/MacroInfo.h (working copy)
@@ -17,7 +17,6 @@
#include "clang/Lex/Token.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Allocator.h"
-#include <vector>
#include <cassert>
namespace clang {
Index: include/clang/Lex/Lexer.h
===================================================================
--- include/clang/Lex/Lexer.h (revision 130054)
+++ include/clang/Lex/Lexer.h (working copy)
@@ -18,7 +18,6 @@
#include "clang/Basic/LangOptions.h"
#include "llvm/ADT/SmallVector.h"
#include <string>
-#include <vector>
#include <cassert>
namespace clang {
Index: include/clang/Lex/PreprocessorLexer.h
===================================================================
--- include/clang/Lex/PreprocessorLexer.h (revision 130054)
+++ include/clang/Lex/PreprocessorLexer.h (working copy)
@@ -17,7 +17,6 @@
#include "clang/Lex/MultipleIncludeOpt.h"
#include "clang/Lex/Token.h"
#include "llvm/ADT/SmallVector.h"
-#include <string>
namespace clang {
Index: include/clang/Driver/Arg.h
===================================================================
--- include/clang/Driver/Arg.h (revision 130054)
+++ include/clang/Driver/Arg.h (working copy)
@@ -13,7 +13,6 @@
#include "Util.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
-#include <vector>
#include <string>
namespace clang {
Index: include/clang/StaticAnalyzer/Core/CheckerProvider.h
===================================================================
--- include/clang/StaticAnalyzer/Core/CheckerProvider.h (revision 130054)
+++ include/clang/StaticAnalyzer/Core/CheckerProvider.h (working copy)
@@ -15,7 +15,6 @@
#define LLVM_CLANG_SA_CORE_CHECKERPROVIDER_H
#include "llvm/ADT/StringRef.h"
-#include <vector>
namespace llvm {
class raw_ostream;
Index: include/clang/Parse/Parser.h
===================================================================
--- include/clang/Parse/Parser.h (revision 130054)
+++ include/clang/Parse/Parser.h (working copy)
@@ -22,7 +22,6 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/ADT/OwningPtr.h"
#include <stack>
-#include <list>
namespace clang {
class PragmaHandler;
Index: lib/AST/DeclBase.cpp
===================================================================
--- lib/AST/DeclBase.cpp (revision 130054)
+++ lib/AST/DeclBase.cpp (working copy)
@@ -30,7 +30,6 @@
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstdio>
-#include <vector>
using namespace clang;
//===----------------------------------------------------------------------===//
Index: lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp (revision 130054)
+++ lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp (working copy)
@@ -59,7 +59,6 @@
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/Support/ErrorHandling.h"
-#include <deque>
using namespace clang;
using namespace ento;
Index: lib/StaticAnalyzer/Core/CoreEngine.cpp
===================================================================
--- lib/StaticAnalyzer/Core/CoreEngine.cpp (revision 130054)
+++ lib/StaticAnalyzer/Core/CoreEngine.cpp (working copy)
@@ -19,8 +19,6 @@
#include "clang/AST/Expr.h"
#include "llvm/Support/Casting.h"
#include "llvm/ADT/DenseMap.h"
-#include <vector>
-#include <queue>
using llvm::cast;
using llvm::isa;
Index: lib/CodeGen/CGObjCGNU.cpp
===================================================================
--- lib/CodeGen/CGObjCGNU.cpp (revision 130054)
+++ lib/CodeGen/CGObjCGNU.cpp (working copy)
@@ -36,7 +36,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Target/TargetData.h"
-#include <map>
#include <stdarg.h>
Index: lib/CodeGen/CGObjCRuntime.h
===================================================================
--- lib/CodeGen/CGObjCRuntime.h (revision 130054)
+++ lib/CodeGen/CGObjCRuntime.h (working copy)
@@ -17,7 +17,6 @@
#define CLANG_CODEGEN_OBCJRUNTIME_H
#include "clang/Basic/IdentifierTable.h" // Selector
#include "clang/AST/DeclObjC.h"
-#include <string>
#include "CGBuilder.h"
#include "CGCall.h"
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits