Skip to content

Commit f77d115

Browse files
committed
[clang] Move ApplyHeaderSearchOptions from Frontend to Lex
In D116750, the `clangFrontend` library was added as a dependency of `LexTests` in order to make `clang::ApplyHeaderSearchOptions()` available. This increased the number of TUs the test depends on. This patch moves the function into `clangLex` and removes dependency of `LexTests` on `clangFrontend`. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D117024
1 parent 134e9d1 commit f77d115

File tree

7 files changed

+14
-21
lines changed

7 files changed

+14
-21
lines changed

clang/include/clang/Frontend/Utils.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@
3232
#include <utility>
3333
#include <vector>
3434

35-
namespace llvm {
36-
37-
class Triple;
38-
39-
} // namespace llvm
40-
4135
namespace clang {
4236

4337
class ASTReader;
@@ -46,20 +40,11 @@ class CompilerInvocation;
4640
class DiagnosticsEngine;
4741
class ExternalSemaSource;
4842
class FrontendOptions;
49-
class HeaderSearch;
50-
class HeaderSearchOptions;
51-
class LangOptions;
5243
class PCHContainerReader;
5344
class Preprocessor;
5445
class PreprocessorOptions;
5546
class PreprocessorOutputOptions;
5647

57-
/// Apply the header search options to get given HeaderSearch object.
58-
void ApplyHeaderSearchOptions(HeaderSearch &HS,
59-
const HeaderSearchOptions &HSOpts,
60-
const LangOptions &Lang,
61-
const llvm::Triple &triple);
62-
6348
/// InitializePreprocessor - Initialize the preprocessor getting it and the
6449
/// environment ready to process a single file.
6550
void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts,

clang/include/clang/Lex/HeaderSearch.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434
#include <utility>
3535
#include <vector>
3636

37+
namespace llvm {
38+
39+
class Triple;
40+
41+
} // namespace llvm
42+
3743
namespace clang {
3844

3945
class DiagnosticsEngine;
@@ -853,6 +859,12 @@ class HeaderSearch {
853859
bool IsSystem, bool IsFramework);
854860
};
855861

862+
/// Apply the header search options to get given HeaderSearch object.
863+
void ApplyHeaderSearchOptions(HeaderSearch &HS,
864+
const HeaderSearchOptions &HSOpts,
865+
const LangOptions &Lang,
866+
const llvm::Triple &triple);
867+
856868
} // namespace clang
857869

858870
#endif // LLVM_CLANG_LEX_HEADERSEARCH_H

clang/lib/Frontend/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ add_clang_library(clangFrontend
2424
FrontendActions.cpp
2525
FrontendOptions.cpp
2626
HeaderIncludeGen.cpp
27-
InitHeaderSearch.cpp
2827
InitPreprocessor.cpp
2928
LayoutOverrideSource.cpp
3029
LogDiagnosticPrinter.cpp

clang/lib/Lex/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_clang_library(clangLex
66
DependencyDirectivesSourceMinimizer.cpp
77
HeaderMap.cpp
88
HeaderSearch.cpp
9+
InitHeaderSearch.cpp
910
Lexer.cpp
1011
LiteralSupport.cpp
1112
MacroArgs.cpp

clang/lib/Frontend/InitHeaderSearch.cpp renamed to clang/lib/Lex/InitHeaderSearch.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#include "clang/Basic/DiagnosticFrontend.h"
1314
#include "clang/Basic/FileManager.h"
1415
#include "clang/Basic/LangOptions.h"
1516
#include "clang/Config/config.h" // C_INCLUDE_DIRS
16-
#include "clang/Frontend/FrontendDiagnostic.h"
17-
#include "clang/Frontend/Utils.h"
1817
#include "clang/Lex/HeaderMap.h"
1918
#include "clang/Lex/HeaderSearch.h"
2019
#include "clang/Lex/HeaderSearchOptions.h"

clang/unittests/Lex/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ clang_target_link_libraries(LexTests
1515
PRIVATE
1616
clangAST
1717
clangBasic
18-
clangFrontend
1918
clangLex
2019
clangParse
2120
clangSema

clang/unittests/Lex/HeaderSearchTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include "clang/Basic/SourceManager.h"
1616
#include "clang/Basic/TargetInfo.h"
1717
#include "clang/Basic/TargetOptions.h"
18-
#include "clang/Frontend/Utils.h"
19-
#include "clang/Lex/HeaderSearch.h"
2018
#include "clang/Lex/HeaderSearchOptions.h"
2119
#include "clang/Serialization/InMemoryModuleCache.h"
2220
#include "llvm/Support/MemoryBuffer.h"

0 commit comments

Comments
 (0)