[cfe-commits] r86883 - in /cfe/trunk: include/clang/Frontend/Utils.h lib/Frontend/InitPreprocessor.cpp tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 11 13:44:42 PST 2009
Author: ddunbar
Date: Wed Nov 11 15:44:42 2009
New Revision: 86883
URL: http://llvm.org/viewvc/llvm-project?rev=86883&view=rev
Log:
Always initialize the header search object as part of InitializePreprocessor;
not doing this has little to no utility.
Modified:
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Frontend/Utils.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=86883&r1=86882&r2=86883&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Wed Nov 11 15:44:42 2009
@@ -48,9 +48,9 @@
/// 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.
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=86883&r1=86882&r2=86883&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Nov 11 15:44:42 2009
@@ -456,7 +456,8 @@
/// 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";
@@ -501,4 +502,9 @@
// 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());
}
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86883&r1=86882&r2=86883&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Wed Nov 11 15:44:42 2009
@@ -377,6 +377,7 @@
static Preprocessor *
CreatePreprocessor(Diagnostic &Diags, const LangOptions &LangInfo,
const PreprocessorOptions &PPOpts,
+ const HeaderSearchOptions &HSOpts,
const DependencyOutputOptions &DepOpts,
TargetInfo &Target, SourceManager &SourceMgr,
FileManager &FileMgr) {
@@ -413,7 +414,7 @@
PP->setPTHManager(PTHMgr);
}
- InitializePreprocessor(*PP, PPOpts);
+ InitializePreprocessor(*PP, PPOpts, HSOpts);
// Handle generating dependencies, if requested.
if (!DepOpts.OutputFile.empty())
@@ -1209,14 +1210,10 @@
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;
More information about the cfe-commits
mailing list