[clang-tidy] Fix a compiler warning.

Rename the Preprocessor field to fix the

  declaration of ‘std::unique_ptr<clang::Preprocessor> clang::tooling::ExpandModularHeadersPPCallbacks::Preprocessor’ changes the meaning of ‘Preprocessor’ from ‘class clang::Preprocessor’ [-fpermissive]

warning.

llvm-svn: 356756
This commit is contained in:
Alexander Kornienko 2019-03-22 15:07:18 +00:00
parent 677387d8dc
commit 1ae5c63f35
2 changed files with 12 additions and 12 deletions

View File

@ -78,12 +78,12 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
auto PO = std::make_shared<PreprocessorOptions>();
*PO = Compiler.getPreprocessorOpts();
Preprocessor = llvm::make_unique<clang::Preprocessor>(
PO, Diags, LangOpts, Sources, *HeaderInfo, ModuleLoader,
/*IILookup=*/nullptr,
/*OwnsHeaderSearch=*/false);
Preprocessor->Initialize(Compiler.getTarget(), Compiler.getAuxTarget());
InitializePreprocessor(*Preprocessor, *PO, Compiler.getPCHContainerReader(),
PP = llvm::make_unique<clang::Preprocessor>(PO, Diags, LangOpts, Sources,
*HeaderInfo, ModuleLoader,
/*IILookup=*/nullptr,
/*OwnsHeaderSearch=*/false);
PP->Initialize(Compiler.getTarget(), Compiler.getAuxTarget());
InitializePreprocessor(*PP, *PO, Compiler.getPCHContainerReader(),
Compiler.getFrontendOpts());
ApplyHeaderSearchOptions(*HeaderInfo, *HSO, LangOpts,
Compiler.getTarget().getTriple());
@ -92,7 +92,7 @@ ExpandModularHeadersPPCallbacks::ExpandModularHeadersPPCallbacks(
ExpandModularHeadersPPCallbacks::~ExpandModularHeadersPPCallbacks() = default;
Preprocessor *ExpandModularHeadersPPCallbacks::getPreprocessor() const {
return Preprocessor.get();
return PP.get();
}
void ExpandModularHeadersPPCallbacks::handleModuleFile(
@ -129,11 +129,11 @@ void ExpandModularHeadersPPCallbacks::parseToLocation(SourceLocation Loc) {
if (!StartedLexing) {
StartedLexing = true;
Preprocessor->Lex(CurrentToken);
PP->Lex(CurrentToken);
}
while (!CurrentToken.is(tok::eof) &&
Sources.isBeforeInTranslationUnit(CurrentToken.getLocation(), Loc)) {
Preprocessor->Lex(CurrentToken);
PP->Lex(CurrentToken);
}
}
@ -142,7 +142,7 @@ void ExpandModularHeadersPPCallbacks::FileChanged(
SrcMgr::CharacteristicKind FileType, FileID PrevFID = FileID()) {
if (!EnteredMainFile) {
EnteredMainFile = true;
Preprocessor->EnterMainSourceFile();
PP->EnterMainSourceFile();
}
}
@ -162,7 +162,7 @@ void ExpandModularHeadersPPCallbacks::InclusionDirective(
void ExpandModularHeadersPPCallbacks::EndOfMainFile() {
while (!CurrentToken.is(tok::eof))
Preprocessor->Lex(CurrentToken);
PP->Lex(CurrentToken);
}
// Handle all other callbacks.

View File

@ -125,7 +125,7 @@ private:
TrivialModuleLoader ModuleLoader;
std::unique_ptr<HeaderSearch> HeaderInfo;
std::unique_ptr<Preprocessor> Preprocessor;
std::unique_ptr<Preprocessor> PP;
bool EnteredMainFile = false;
bool StartedLexing = false;
Token CurrentToken;