Skip to content

Commit b2082a9

Browse files
committed
Revert "[clang-format][NFC] Delete 100+ redundant #include lines in .cpp files"
This reverts commit b92d6dd. See github.com/llvm/llvm-project/commit/b92d6dd704d7#commitcomment-139992444 We should use a tool like Visual Studio to clean up the headers.
1 parent f375aff commit b2082a9

19 files changed

+106
-0
lines changed

clang/lib/Format/AffectedRangeManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "AffectedRangeManager.h"
1515

16+
#include "FormatToken.h"
1617
#include "TokenAnnotator.h"
1718

1819
namespace clang {

clang/lib/Format/BreakableToken.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
#include "BreakableToken.h"
1616
#include "ContinuationIndenter.h"
1717
#include "clang/Basic/CharInfo.h"
18+
#include "clang/Format/Format.h"
19+
#include "llvm/ADT/STLExtras.h"
20+
#include "llvm/Support/Debug.h"
21+
#include <algorithm>
1822

1923
#define DEBUG_TYPE "format-token-breaker"
2024

clang/lib/Format/ContinuationIndenter.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
#include "ContinuationIndenter.h"
1515
#include "BreakableToken.h"
1616
#include "FormatInternal.h"
17+
#include "FormatToken.h"
18+
#include "WhitespaceManager.h"
19+
#include "clang/Basic/OperatorPrecedence.h"
20+
#include "clang/Basic/SourceManager.h"
21+
#include "clang/Basic/TokenKinds.h"
22+
#include "clang/Format/Format.h"
23+
#include "llvm/ADT/StringSet.h"
24+
#include "llvm/Support/Debug.h"
25+
#include <optional>
1726

1827
#define DEBUG_TYPE "format-indenter"
1928

clang/lib/Format/DefinitionBlockSeparator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//===----------------------------------------------------------------------===//
1515

1616
#include "DefinitionBlockSeparator.h"
17+
#include "llvm/Support/Debug.h"
1718
#define DEBUG_TYPE "definition-block-separator"
1819

1920
namespace clang {

clang/lib/Format/FormatToken.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
#include "FormatToken.h"
1616
#include "ContinuationIndenter.h"
17+
#include "llvm/ADT/SmallVector.h"
18+
#include "llvm/Support/Debug.h"
19+
#include <climits>
1720

1821
namespace clang {
1922
namespace format {

clang/lib/Format/FormatTokenLexer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "FormatTokenLexer.h"
16+
#include "FormatToken.h"
17+
#include "clang/Basic/SourceLocation.h"
1618
#include "clang/Basic/SourceManager.h"
19+
#include "clang/Format/Format.h"
20+
#include "llvm/Support/Regex.h"
1721

1822
namespace clang {
1923
namespace format {

clang/lib/Format/MacroCallReconstructor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
#include "Macros.h"
1717

1818
#include "UnwrappedLineParser.h"
19+
#include "clang/Basic/TokenKinds.h"
1920
#include "llvm/ADT/DenseSet.h"
21+
#include "llvm/Support/Debug.h"
22+
#include <cassert>
2023

2124
#define DEBUG_TYPE "format-reconstruct"
2225

clang/lib/Format/MacroExpander.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@
1414

1515
#include "Macros.h"
1616

17+
#include "Encoding.h"
18+
#include "FormatToken.h"
1719
#include "FormatTokenLexer.h"
20+
#include "clang/Basic/TokenKinds.h"
21+
#include "clang/Format/Format.h"
22+
#include "clang/Lex/HeaderSearch.h"
23+
#include "clang/Lex/HeaderSearchOptions.h"
24+
#include "clang/Lex/Lexer.h"
25+
#include "clang/Lex/ModuleLoader.h"
1826
#include "clang/Lex/Preprocessor.h"
27+
#include "clang/Lex/PreprocessorOptions.h"
28+
#include "llvm/ADT/StringSet.h"
29+
#include "llvm/Support/ErrorHandling.h"
1930

2031
namespace clang {
2132
namespace format {

clang/lib/Format/NamespaceEndCommentsFixer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "NamespaceEndCommentsFixer.h"
16+
#include "clang/Basic/TokenKinds.h"
17+
#include "llvm/Support/Debug.h"
18+
#include "llvm/Support/Regex.h"
1619

1720
#define DEBUG_TYPE "namespace-end-comments-fixer"
1821

clang/lib/Format/ObjCPropertyAttributeOrderFixer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
#include "ObjCPropertyAttributeOrderFixer.h"
1717

18+
#include <algorithm>
19+
1820
namespace clang {
1921
namespace format {
2022

clang/lib/Format/QualifierAlignmentFixer.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "QualifierAlignmentFixer.h"
16+
#include "FormatToken.h"
17+
#include "llvm/Support/Debug.h"
18+
#include "llvm/Support/Regex.h"
19+
20+
#include <algorithm>
21+
#include <optional>
1622

1723
#define DEBUG_TYPE "format-qualifier-alignment-fixer"
1824

clang/lib/Format/SortJavaScriptImports.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@
1313

1414
#include "SortJavaScriptImports.h"
1515
#include "TokenAnalyzer.h"
16+
#include "TokenAnnotator.h"
17+
#include "clang/Basic/Diagnostic.h"
18+
#include "clang/Basic/DiagnosticOptions.h"
19+
#include "clang/Basic/LLVM.h"
20+
#include "clang/Basic/SourceLocation.h"
21+
#include "clang/Basic/SourceManager.h"
22+
#include "clang/Basic/TokenKinds.h"
23+
#include "clang/Format/Format.h"
24+
#include "llvm/ADT/STLExtras.h"
25+
#include "llvm/ADT/SmallVector.h"
26+
#include "llvm/Support/Debug.h"
27+
#include <algorithm>
28+
#include <string>
1629

1730
#define DEBUG_TYPE "format-formatter"
1831

clang/lib/Format/TokenAnalyzer.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
//===----------------------------------------------------------------------===//
1515

1616
#include "TokenAnalyzer.h"
17+
#include "AffectedRangeManager.h"
18+
#include "Encoding.h"
19+
#include "FormatToken.h"
20+
#include "FormatTokenLexer.h"
21+
#include "TokenAnnotator.h"
22+
#include "UnwrappedLineParser.h"
23+
#include "clang/Basic/Diagnostic.h"
24+
#include "clang/Basic/DiagnosticOptions.h"
25+
#include "clang/Basic/FileManager.h"
26+
#include "clang/Basic/SourceManager.h"
27+
#include "clang/Format/Format.h"
28+
#include "llvm/ADT/STLExtras.h"
29+
#include "llvm/ADT/SmallVector.h"
30+
#include "llvm/Support/Debug.h"
31+
#include <type_traits>
1732

1833
#define DEBUG_TYPE "format-formatter"
1934

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "TokenAnnotator.h"
16+
#include "FormatToken.h"
17+
#include "clang/Basic/SourceManager.h"
18+
#include "clang/Basic/TokenKinds.h"
1619
#include "llvm/ADT/SmallPtrSet.h"
20+
#include "llvm/Support/Debug.h"
1721

1822
#define DEBUG_TYPE "format-token-annotator"
1923

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "UnwrappedLineFormatter.h"
10+
#include "FormatToken.h"
1011
#include "NamespaceEndCommentsFixer.h"
1112
#include "WhitespaceManager.h"
13+
#include "llvm/Support/Debug.h"
1214
#include <queue>
1315

1416
#define DEBUG_TYPE "format-formatter"

clang/lib/Format/UnwrappedLineParser.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "UnwrappedLineParser.h"
16+
#include "FormatToken.h"
17+
#include "FormatTokenLexer.h"
1618
#include "FormatTokenSource.h"
19+
#include "Macros.h"
1720
#include "TokenAnnotator.h"
21+
#include "clang/Basic/TokenKinds.h"
22+
#include "llvm/ADT/STLExtras.h"
23+
#include "llvm/ADT/StringRef.h"
24+
#include "llvm/Support/Debug.h"
1825
#include "llvm/Support/raw_os_ostream.h"
26+
#include "llvm/Support/raw_ostream.h"
27+
28+
#include <algorithm>
29+
#include <utility>
1930

2031
#define DEBUG_TYPE "format-parser"
2132

clang/lib/Format/UsingDeclarationsSorter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "UsingDeclarationsSorter.h"
16+
#include "clang/Format/Format.h"
17+
#include "llvm/Support/Debug.h"
18+
#include "llvm/Support/Regex.h"
19+
20+
#include <algorithm>
1621

1722
#define DEBUG_TYPE "using-declarations-sorter"
1823

clang/lib/Format/WhitespaceManager.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
#include "WhitespaceManager.h"
15+
#include "llvm/ADT/STLExtras.h"
16+
#include "llvm/ADT/SmallVector.h"
17+
#include <algorithm>
1518

1619
namespace clang {
1720
namespace format {

clang/tools/clang-format/ClangFormat.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "../../lib/Format/MatchFilePath.h"
16+
#include "clang/Basic/Diagnostic.h"
17+
#include "clang/Basic/DiagnosticOptions.h"
18+
#include "clang/Basic/FileManager.h"
1619
#include "clang/Basic/SourceManager.h"
1720
#include "clang/Basic/Version.h"
1821
#include "clang/Format/Format.h"
1922
#include "clang/Rewrite/Core/Rewriter.h"
23+
#include "llvm/ADT/StringSwitch.h"
2024
#include "llvm/Support/CommandLine.h"
25+
#include "llvm/Support/FileSystem.h"
2126
#include "llvm/Support/InitLLVM.h"
27+
#include "llvm/Support/Process.h"
2228
#include <fstream>
2329

2430
using namespace llvm;

0 commit comments

Comments
 (0)