[PATCH] D84591: Replace comment by private method

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


hanneskaeufler created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The comment is better served with a small private
method, helping scannability of the code and
hiding irrelevant details about the private members.


Repository:
  rG LLVM Github Monorepo

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:
+  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.280697.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200725/32bf4c4b/attachment.bin>


More information about the cfe-commits mailing list