/// InitializePreprocessor - Initialize the preprocessor getting it and the
/// environment ready to process a single file.
-///
void InitializePreprocessor(Preprocessor &PP,
- const PreprocessorOptions &PPOpts);
+ const PreprocessorOptions &PPOpts,
+ const HeaderSearchOptions &HSOpts);
/// ProcessWarningOptions - Initialize the diagnostic client and process the
/// warning options specified on the command line.
/// environment ready to process a single file. This returns true on error.
///
void clang::InitializePreprocessor(Preprocessor &PP,
- const PreprocessorOptions &InitOpts) {
+ const PreprocessorOptions &InitOpts,
+ const HeaderSearchOptions &HSOpts) {
std::vector<char> PredefineBuffer;
const char *LineDirective = "# 1 \"<built-in>\" 3\n";
// Null terminate PredefinedBuffer and add it.
PredefineBuffer.push_back(0);
PP.setPredefines(&PredefineBuffer[0]);
+
+ // Initialize the header search object.
+ ApplyHeaderSearchOptions(PP.getHeaderSearchInfo(), HSOpts,
+ PP.getLangOptions(),
+ PP.getTargetInfo().getTriple());
}
static Preprocessor *
CreatePreprocessor(Diagnostic &Diags, const LangOptions &LangInfo,
const PreprocessorOptions &PPOpts,
+ const HeaderSearchOptions &HSOpts,
const DependencyOutputOptions &DepOpts,
TargetInfo &Target, SourceManager &SourceMgr,
FileManager &FileMgr) {
PP->setPTHManager(PTHMgr);
}
- InitializePreprocessor(*PP, PPOpts);
+ InitializePreprocessor(*PP, PPOpts, HSOpts);
// Handle generating dependencies, if requested.
if (!DepOpts.OutputFile.empty())
llvm::OwningPtr<Preprocessor>
PP(CreatePreprocessor(Diags, CompOpts.getLangOpts(),
CompOpts.getPreprocessorOpts(),
+ CompOpts.getHeaderSearchOpts(),
CompOpts.getDependencyOutputOpts(),
*Target, SourceMgr, FileMgr));
- // Apply all the options to the header search object.
- ApplyHeaderSearchOptions(PP->getHeaderSearchInfo(),
- CompOpts.getHeaderSearchOpts(),
- CompOpts.getLangOpts(), Triple);
-
if (CompOpts.getPreprocessorOpts().getImplicitPCHInclude().empty()) {
if (InitializeSourceManager(*PP.get(), InFile))
continue;