[clang-tools-extra] r356756 - [clang-tidy] Fix a compiler warning.

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 22 08:07:18 PDT 2019


Author: alexfh
Date: Fri Mar 22 08:07:18 2019
New Revision: 356756

URL: http://llvm.org/viewvc/llvm-project?rev=356756&view=rev
Log:
[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.

Modified:
    clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
    clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.h

Modified: clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.cpp?rev=356756&r1=356755&r2=356756&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.cpp Fri Mar 22 08:07:18 2019
@@ -78,12 +78,12 @@ ExpandModularHeadersPPCallbacks::ExpandM
   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::ExpandM
 ExpandModularHeadersPPCallbacks::~ExpandModularHeadersPPCallbacks() = default;
 
 Preprocessor *ExpandModularHeadersPPCallbacks::getPreprocessor() const {
-  return Preprocessor.get();
+  return PP.get();
 }
 
 void ExpandModularHeadersPPCallbacks::handleModuleFile(
@@ -129,11 +129,11 @@ void ExpandModularHeadersPPCallbacks::pa
 
   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::Fi
     SrcMgr::CharacteristicKind FileType, FileID PrevFID = FileID()) {
   if (!EnteredMainFile) {
     EnteredMainFile = true;
-    Preprocessor->EnterMainSourceFile();
+    PP->EnterMainSourceFile();
   }
 }
 
@@ -162,7 +162,7 @@ void ExpandModularHeadersPPCallbacks::In
 
 void ExpandModularHeadersPPCallbacks::EndOfMainFile() {
   while (!CurrentToken.is(tok::eof))
-    Preprocessor->Lex(CurrentToken);
+    PP->Lex(CurrentToken);
 }
 
 // Handle all other callbacks.

Modified: clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.h?rev=356756&r1=356755&r2=356756&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ExpandModularHeadersPPCallbacks.h Fri Mar 22 08:07:18 2019
@@ -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;




More information about the cfe-commits mailing list