[PATCH] D84591: [clang-tidy] Replace comment by private method

Hannes Käufler via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 25 14:48:31 PDT 2020


hanneskaeufler updated this revision to Diff 280699.
hanneskaeufler added a comment.

Fix syntax error (add return type)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84591/new/

https://reviews.llvm.org/D84591

Files:
  clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp


Index: clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
===================================================================
--- clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -123,12 +123,7 @@
 
     // Emit warnings for headers that are missing guards.
     checkGuardlessHeaders();
-
-    // Clear all state.
-    Macros.clear();
-    Files.clear();
-    Ifndefs.clear();
-    EndIfs.clear();
+    clearAllState();
   }
 
   bool wouldFixEndifComment(StringRef FileName, SourceLocation EndIf,
@@ -255,6 +250,13 @@
   }
 
 private:
+  void clearAllState() {
+    Macros.clear();
+    Files.clear();
+    Ifndefs.clear();
+    EndIfs.clear();
+  }
+
   std::vector<std::pair<Token, const MacroInfo *>> Macros;
   llvm::StringMap<const FileEntry *> Files;
   std::map<const IdentifierInfo *, std::pair<SourceLocation, SourceLocation>>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84591.280699.patch
Type: text/x-patch
Size: 898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200725/8a16d396/attachment-0001.bin>


More information about the cfe-commits mailing list