[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
This commit is contained in:
Jan Svoboda 2022-01-11 17:17:07 +01:00
parent 134e9d1914
commit f77d115cc1
7 changed files with 14 additions and 21 deletions

View File

@ -32,12 +32,6 @@
#include <utility>
#include <vector>
namespace llvm {
class Triple;
} // namespace llvm
namespace clang {
class ASTReader;
@ -46,20 +40,11 @@ class CompilerInvocation;
class DiagnosticsEngine;
class ExternalSemaSource;
class FrontendOptions;
class HeaderSearch;
class HeaderSearchOptions;
class LangOptions;
class PCHContainerReader;
class Preprocessor;
class PreprocessorOptions;
class PreprocessorOutputOptions;
/// Apply the header search options to get given HeaderSearch object.
void ApplyHeaderSearchOptions(HeaderSearch &HS,
const HeaderSearchOptions &HSOpts,
const LangOptions &Lang,
const llvm::Triple &triple);
/// InitializePreprocessor - Initialize the preprocessor getting it and the
/// environment ready to process a single file.
void InitializePreprocessor(Preprocessor &PP, const PreprocessorOptions &PPOpts,

View File

@ -34,6 +34,12 @@
#include <utility>
#include <vector>
namespace llvm {
class Triple;
} // namespace llvm
namespace clang {
class DiagnosticsEngine;
@ -853,6 +859,12 @@ private:
bool IsSystem, bool IsFramework);
};
/// Apply the header search options to get given HeaderSearch object.
void ApplyHeaderSearchOptions(HeaderSearch &HS,
const HeaderSearchOptions &HSOpts,
const LangOptions &Lang,
const llvm::Triple &triple);
} // namespace clang
#endif // LLVM_CLANG_LEX_HEADERSEARCH_H

View File

@ -24,7 +24,6 @@ add_clang_library(clangFrontend
FrontendActions.cpp
FrontendOptions.cpp
HeaderIncludeGen.cpp
InitHeaderSearch.cpp
InitPreprocessor.cpp
LayoutOverrideSource.cpp
LogDiagnosticPrinter.cpp

View File

@ -6,6 +6,7 @@ add_clang_library(clangLex
DependencyDirectivesSourceMinimizer.cpp
HeaderMap.cpp
HeaderSearch.cpp
InitHeaderSearch.cpp
Lexer.cpp
LiteralSupport.cpp
MacroArgs.cpp

View File

@ -10,11 +10,10 @@
//
//===----------------------------------------------------------------------===//
#include "clang/Basic/DiagnosticFrontend.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Config/config.h" // C_INCLUDE_DIRS
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/Utils.h"
#include "clang/Lex/HeaderMap.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"

View File

@ -15,7 +15,6 @@ clang_target_link_libraries(LexTests
PRIVATE
clangAST
clangBasic
clangFrontend
clangLex
clangParse
clangSema

View File

@ -15,8 +15,6 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/TargetOptions.h"
#include "clang/Frontend/Utils.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/HeaderSearchOptions.h"
#include "clang/Serialization/InMemoryModuleCache.h"
#include "llvm/Support/MemoryBuffer.h"