github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- 
clang/test/Interpreter/Inputs/dynamic-header.h 
clang/include/clang/Basic/FileManager.h 
clang/include/clang/Basic/SourceManager.h 
clang/include/clang/Interpreter/PartialTranslationUnit.h 
clang/include/clang/Lex/Preprocessor.h clang/lib/Basic/FileManager.cpp 
clang/lib/Basic/SourceManager.cpp clang/lib/Interpreter/IncrementalParser.cpp 
clang/lib/Interpreter/IncrementalParser.h clang/lib/Interpreter/Interpreter.cpp 
clang/lib/Lex/PPMacroExpansion.cpp clang/test/Interpreter/code-undo.cpp 
--diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/Basic/FileManager.h 
b/clang/include/clang/Basic/FileManager.h
index e3629053e..9de7f2716 100644
--- a/clang/include/clang/Basic/FileManager.h
+++ b/clang/include/clang/Basic/FileManager.h
@@ -31,8 +31,8 @@
 #include <ctime>
 #include <map>
 #include <memory>
-#include <string>
 #include <set>
+#include <string>
 
 namespace llvm {
 
@@ -107,8 +107,8 @@ class FileManager : public RefCountedBase<FileManager> {
 
   /// The canonical names of files and directories .
   llvm::DenseMap<const void *, llvm::StringRef> CanonicalNames;
-  
-  std::set<const FileEntry*> FileEntriesToReread;
+
+  std::set<const FileEntry *> FileEntriesToReread;
 
   /// The canonical names of directories.
   llvm::DenseMap<const DirectoryEntry *, llvm::StringRef> CanonicalDirNames;
@@ -292,7 +292,7 @@ public:
 
   /// Remove the real file \p Entry from the cache.
   void invalidateCache(FileEntryRef Entry);
-  
+
   /// If path is not absolute and FileSystemOptions set the working
   /// directory, the path is modified to be relative to the given
   /// working directory.
diff --git a/clang/include/clang/Interpreter/PartialTranslationUnit.h 
b/clang/include/clang/Interpreter/PartialTranslationUnit.h
index 86031ace8..f78767da1 100644
--- a/clang/include/clang/Interpreter/PartialTranslationUnit.h
+++ b/clang/include/clang/Interpreter/PartialTranslationUnit.h
@@ -34,7 +34,7 @@ struct PartialTranslationUnit {
   bool operator==(const PartialTranslationUnit &other) {
     return other.TUPart == TUPart && other.TheModule == TheModule;
   }
-  
+
   ///\brief Each macro pair (is this the same as for decls?)came
   /// through different interface at
   /// different time. We are being conservative and we want to keep all the
@@ -43,15 +43,14 @@ struct PartialTranslationUnit {
   struct MacroDirectiveInfo {
     // We need to store both the IdentifierInfo and the MacroDirective
     // because the Preprocessor stores the macros in a DenseMap<II, MD>.
-    IdentifierInfo* II;
-    const MacroDirective* MD;
-    MacroDirectiveInfo(IdentifierInfo* II,
-                       const MacroDirective* MD)
-              : II(II), MD(MD) {}
-    inline bool operator==(const MacroDirectiveInfo& rhs) const {
+    IdentifierInfo *II;
+    const MacroDirective *MD;
+    MacroDirectiveInfo(IdentifierInfo *II, const MacroDirective *MD)
+        : II(II), MD(MD) {}
+    inline bool operator==(const MacroDirectiveInfo &rhs) const {
       return II == rhs.II && MD == rhs.MD;
     }
-    inline bool operator!=(const MacroDirectiveInfo& rhs) const {
+    inline bool operator!=(const MacroDirectiveInfo &rhs) const {
       return !operator==(rhs);
     }
   };
@@ -63,7 +62,7 @@ struct PartialTranslationUnit {
   ///\brief All seen macros.
   ///
   MacroDirectiveInfoQueue MacroDirectiveInfos;
-  
+
   /// Files that were #included during this PTU's parsing.
   /// Used to reset HeaderFileInfo on Undo.
   std::vector<FileEntryRef> IncludedFiles;
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 1ada1e004..15cf8f802 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -225,7 +225,7 @@ llvm::Expected<FileEntryRef> 
FileManager::getFileRef(StringRef Filename,
   if (NamedFileEnt && NamedFileEnt->getValue()) {
     FileEntryRef::MapValue Value = *NamedFileEnt->getValue();
     if (Value.V.is<FileEntry *>()) {
-      auto found = FileEntriesToReread.find(Value.V.get<FileEntry*>());
+      auto found = FileEntriesToReread.find(Value.V.get<FileEntry *>());
       if (found != FileEntriesToReread.end()) {
         needsRereading = true;
         StaleFileEntry = *found;
@@ -372,13 +372,13 @@ llvm::Expected<FileEntryRef> 
FileManager::getFileRef(StringRef Filename,
 
   if (StaleFileEntry) {
     // Find occurrences of old FileEntry; update with new one:
-    for (auto& fe: SeenFileEntries) {
+    for (auto &fe : SeenFileEntries) {
       if (fe.getValue()) {
         FileEntryRef::MapValue Value = *fe.getValue();
-        if (Value.V.is<FileEntry *>()
-            && Value.V.get<FileEntry*>() == StaleFileEntry) {
+        if (Value.V.is<FileEntry *>() &&
+            Value.V.get<FileEntry *>() == StaleFileEntry) {
           fe.setValue(FileEntryRef::MapValue(*UFE, DirInfo));
-            }
+        }
       }
     }
   }
diff --git a/clang/lib/Interpreter/IncrementalParser.cpp 
b/clang/lib/Interpreter/IncrementalParser.cpp
index 44101944e..43fea916a 100644
--- a/clang/lib/Interpreter/IncrementalParser.cpp
+++ b/clang/lib/Interpreter/IncrementalParser.cpp
@@ -32,57 +32,52 @@ namespace clang {
 class IncrementalPreProcessorTracker : public PPCallbacks {
   std::vector<FileEntryRef> IncludedFiles;
   PartialTranslationUnit::MacroDirectiveInfoQueue MacroDirectives;
-  void MacroDirective(const clang::Token& MacroNameTok,
-                        const clang::MacroDirective* MD) {
-    PartialTranslationUnit::MacroDirectiveInfo 
MDE(MacroNameTok.getIdentifierInfo(), MD);
+  void MacroDirective(const clang::Token &MacroNameTok,
+                      const clang::MacroDirective *MD) {
+    PartialTranslationUnit::MacroDirectiveInfo MDE(
+        MacroNameTok.getIdentifierInfo(), MD);
     MacroDirectives.push_back(MDE);
   }
+
 public:
-  explicit IncrementalPreProcessorTracker() {}  
-  void InclusionDirective(
-      SourceLocation HashLoc,
-      const Token &IncludeTok,
-      StringRef FileName,
-      bool IsAngled,
-      CharSourceRange FilenameRange,
-      OptionalFileEntryRef File,
-      StringRef SearchPath,
-      StringRef RelativePath,
-      const Module *SuggestedModule,
-      bool ModuleImported,
-      SrcMgr::CharacteristicKind FileType) override {
-    
+  explicit IncrementalPreProcessorTracker() {}
+  void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
+                          StringRef FileName, bool IsAngled,
+                          CharSourceRange FilenameRange,
+                          OptionalFileEntryRef File, StringRef SearchPath,
+                          StringRef RelativePath, const Module 
*SuggestedModule,
+                          bool ModuleImported,
+                          SrcMgr::CharacteristicKind FileType) override {
+
     if (File) {
       IncludedFiles.push_back(*File);
     }
   }
-  
+
   /// \name PPCallbacks overrides
   /// Macro support
-  void MacroDefined(const clang::Token& MacroNameTok,
-                    const clang::MacroDirective* MD) final {
+  void MacroDefined(const clang::Token &MacroNameTok,
+                    const clang::MacroDirective *MD) final {
     MacroDirective(MacroNameTok, MD);
   }
 
   /// \name PPCallbacks overrides
   /// Macro support
-  void MacroUndefined(const clang::Token& MacroNameTok,
-                      const clang::MacroDefinition& /*MD*/,
-                      const clang::MacroDirective* Undef) final {
+  void MacroUndefined(const clang::Token &MacroNameTok,
+                      const clang::MacroDefinition & /*MD*/,
+                      const clang::MacroDirective *Undef) final {
     if (Undef)
       MacroDirective(MacroNameTok, Undef);
   }
-  
+
   /// Move out tracked files after Parse completes
-  std::vector<FileEntryRef> takeFiles() {
-    return std::move(IncludedFiles);
-  }  
-  
+  std::vector<FileEntryRef> takeFiles() { return std::move(IncludedFiles); }
+
   /// Move out tracked macros after Parse completes
   PartialTranslationUnit::MacroDirectiveInfoQueue takeMacros() {
     return std::move(MacroDirectives);
   }
-  
+
   void reset() {
     IncludedFiles.clear();
     MacroDirectives.clear();
@@ -103,7 +98,7 @@ IncrementalParser::IncrementalParser(CompilerInstance 
&Instance,
     External->StartTranslationUnit(Consumer);
 
   P->Initialize();
-  
+
   // track files that are included when parse to support undo
   auto Tracker = std::make_unique<IncrementalPreProcessorTracker>();
   PreProcessorTracker = Tracker.get();
@@ -174,10 +169,10 @@ llvm::Expected<TranslationUnitDecl *>
 IncrementalParser::Parse(llvm::StringRef input) {
   Preprocessor &PP = S.getPreprocessor();
   assert(PP.isIncrementalProcessingEnabled() && "Not in incremental mode!?");
-  
+
   if (PreProcessorTracker)
     PreProcessorTracker->reset();
-  
+
   std::ostringstream SourceName;
   SourceName << "input_line_" << InputCount++;
 
@@ -263,20 +258,21 @@ void IncrementalParser::CleanUpTU(TranslationUnitDecl 
*MostRecentTU) {
   }
 }
 
-void IncrementalParser::CleanUpPTU(const PartialTranslationUnit 
&MostRecentPTU) {
+void IncrementalParser::CleanUpPTU(
+    const PartialTranslationUnit &MostRecentPTU) {
   CleanUpTU(MostRecentPTU.TUPart);
-  
-  auto& PP = P->getPreprocessor();
-  auto& HS = PP.getHeaderSearchInfo();
-  auto& FM = PP.getFileManager();
-  if (!PTUs.back().IncludedFiles.empty()) {      
+
+  auto &PP = P->getPreprocessor();
+  auto &HS = PP.getHeaderSearchInfo();
+  auto &FM = PP.getFileManager();
+  if (!PTUs.back().IncludedFiles.empty()) {
     for (FileEntryRef FE : PTUs.back().IncludedFiles) {
-      HeaderFileInfo& HFI = HS.getFileInfo(FE);
+      HeaderFileInfo &HFI = HS.getFileInfo(FE);
       HFI.IsLocallyIncluded = false;
       HFI.isPragmaOnce = false;
       HFI.LazyControllingMacro = LazyIdentifierInfoPtr();
       HFI.IsValid = false;
-        
+
       FM.invalidateCache(FE);
     }
   }
@@ -301,7 +297,7 @@ IncrementalParser::RegisterPTU(TranslationUnitDecl *TU,
     LLVM_DEBUG(llvm::dbgs() << ", M=" << LastPTU.TheModule.get() << " ("
                             << LastPTU.TheModule->getName() << ")");
   LLVM_DEBUG(llvm::dbgs() << "]\n");
-  
+
   if (PreProcessorTracker) {
     LastPTU.IncludedFiles = std::move(PreProcessorTracker->takeFiles());
     LastPTU.MacroDirectiveInfos = std::move(PreProcessorTracker->takeMacros());
diff --git a/clang/lib/Interpreter/IncrementalParser.h 
b/clang/lib/Interpreter/IncrementalParser.h
index 743dfbf86..df508eb24 100644
--- a/clang/lib/Interpreter/IncrementalParser.h
+++ b/clang/lib/Interpreter/IncrementalParser.h
@@ -54,9 +54,9 @@ protected:
   IncrementalAction *Act = nullptr;
 
   std::list<PartialTranslationUnit> &PTUs;
-  
+
   /// Tracks the include files during parsing
-  IncrementalPreProcessorTracker* PreProcessorTracker;
+  IncrementalPreProcessorTracker *PreProcessorTracker;
 
 public:
   IncrementalParser(CompilerInstance &Instance, IncrementalAction *Act,
@@ -70,7 +70,7 @@ public:
 
   void CleanUpTU(TranslationUnitDecl *MostRecentTU);
 
-  void CleanUpPTU(const PartialTranslationUnit& MostRecentPTU);
+  void CleanUpPTU(const PartialTranslationUnit &MostRecentPTU);
   /// Register a PTU produced by Parse.
   PartialTranslationUnit &RegisterPTU(TranslationUnitDecl *TU,
                                       std::unique_ptr<llvm::Module> M = {});
diff --git a/clang/lib/Interpreter/Interpreter.cpp 
b/clang/lib/Interpreter/Interpreter.cpp
index 327f65529..32a5cbc39 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -585,7 +585,7 @@ llvm::Error Interpreter::Undo(unsigned N) {
             getEffectivePTUSize()),
         std::error_code());
   }
-  
+
   for (unsigned I = 0; I < N; I++) {
     if (IncrExecutor) {
       if (llvm::Error Err = IncrExecutor->removeModule(PTUs.back()))
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp 
b/clang/lib/Lex/PPMacroExpansion.cpp
index 36e346539..77e8fca63 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -95,16 +95,15 @@ void Preprocessor::removeMacro(IdentifierInfo *II, 
MacroDirective *MD) {
   assert(II && MD);
   II->setHasMacroDefinition(false);
   CurSubmoduleState->Macros.erase(II);
-  if (MacroDirective* prevMD = MD->getPrevious()) {
+  if (MacroDirective *prevMD = MD->getPrevious()) {
     // Avoid assertion in appendMacroDirective.
-    MacroDirective* prevPrevMD = prevMD->getPrevious();
+    MacroDirective *prevPrevMD = prevMD->getPrevious();
     prevMD->setPrevious(0);
     appendMacroDirective(II, prevMD);
     prevMD->setPrevious(prevPrevMD);
   }
 }
 
-
 void Preprocessor::setLoadedMacroDirective(IdentifierInfo *II,
                                            MacroDirective *ED,
                                            MacroDirective *MD) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/182750
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to