forked from OSchip/llvm-project
PreprocessorOptions: Get rid of unnecessary 'isPTH' flag for include entries.
llvm-svn: 86757
This commit is contained in:
parent
0169fd7c62
commit
de02f63945
|
@ -10,6 +10,7 @@
|
|||
#ifndef LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
|
||||
#define LLVM_CLANG_FRONTEND_PREPROCESSOROPTIONS_H_
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -22,7 +23,7 @@ class LangOptions;
|
|||
/// used in preprocessor initialization to InitializePreprocessor().
|
||||
class PreprocessorOptions {
|
||||
std::vector<std::pair<std::string, bool/*isUndef*/> > Macros;
|
||||
std::vector<std::pair<std::string, bool/*isPTH*/> > Includes;
|
||||
std::vector<std::string> Includes;
|
||||
std::vector<std::string> MacroIncludes;
|
||||
|
||||
unsigned UsePredefines : 1; /// Initialize the preprocessor with the compiler
|
||||
|
@ -61,14 +62,14 @@ public:
|
|||
ImplicitPTHInclude = Value;
|
||||
}
|
||||
|
||||
void addMacroDef(const std::string &Name) {
|
||||
void addMacroDef(llvm::StringRef Name) {
|
||||
Macros.push_back(std::make_pair(Name, false));
|
||||
}
|
||||
void addMacroUndef(const std::string &Name) {
|
||||
void addMacroUndef(llvm::StringRef Name) {
|
||||
Macros.push_back(std::make_pair(Name, true));
|
||||
}
|
||||
void addInclude(const std::string &Name, bool isPTH = false) {
|
||||
Includes.push_back(std::make_pair(Name, isPTH));
|
||||
void addInclude(llvm::StringRef Name) {
|
||||
Includes.push_back(Name);
|
||||
}
|
||||
void addMacroInclude(const std::string &Name) {
|
||||
MacroIncludes.push_back(Name);
|
||||
|
@ -79,8 +80,7 @@ public:
|
|||
macro_iterator macro_begin() const { return Macros.begin(); }
|
||||
macro_iterator macro_end() const { return Macros.end(); }
|
||||
|
||||
typedef std::vector<std::pair<std::string,
|
||||
bool> >::const_iterator include_iterator;
|
||||
typedef std::vector<std::string>::const_iterator include_iterator;
|
||||
include_iterator include_begin() const { return Includes.begin(); }
|
||||
include_iterator include_end() const { return Includes.end(); }
|
||||
|
||||
|
|
|
@ -492,10 +492,10 @@ void clang::InitializePreprocessor(Preprocessor &PP,
|
|||
// Process -include directives.
|
||||
for (PreprocessorOptions::include_iterator I = InitOpts.include_begin(),
|
||||
E = InitOpts.include_end(); I != E; ++I) {
|
||||
if (I->second) // isPTH
|
||||
AddImplicitIncludePTH(PredefineBuffer, PP, I->first);
|
||||
if (*I == InitOpts.getImplicitPTHInclude())
|
||||
AddImplicitIncludePTH(PredefineBuffer, PP, *I);
|
||||
else
|
||||
AddImplicitInclude(PredefineBuffer, I->first);
|
||||
AddImplicitInclude(PredefineBuffer, *I);
|
||||
}
|
||||
|
||||
// Null terminate PredefinedBuffer and add it.
|
||||
|
|
|
@ -1135,9 +1135,9 @@ static void InitializePreprocessorOptions(PreprocessorOptions &InitOpts) {
|
|||
if (!ImplicitIncludes.empty() &&
|
||||
Ptr >= &ImplicitIncludes[0] &&
|
||||
Ptr <= &ImplicitIncludes[ImplicitIncludes.size()-1]) {
|
||||
InitOpts.addInclude(*Ptr, false);
|
||||
InitOpts.addInclude(*Ptr);
|
||||
} else if (Ptr == &ImplicitIncludePTH) {
|
||||
InitOpts.addInclude(*Ptr, true);
|
||||
InitOpts.addInclude(*Ptr);
|
||||
} else {
|
||||
// We end up here when we're producing preprocessed output and
|
||||
// we loaded a PCH file. In this case, just include the header
|
||||
|
@ -1145,7 +1145,7 @@ static void InitializePreprocessorOptions(PreprocessorOptions &InitOpts) {
|
|||
assert(Ptr == &ImplicitIncludePCH);
|
||||
std::string OriginalFile = PCHReader::getOriginalSourceFile(*Ptr);
|
||||
if (!OriginalFile.empty()) {
|
||||
InitOpts.addInclude(OriginalFile, false);
|
||||
InitOpts.addInclude(OriginalFile);
|
||||
InitOpts.setImplicitPCHInclude("");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue