[clang-tools-extra] 3bbf3e0 - Replace comment by private method; NFC.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 26 11:00:32 PDT 2020


Author: Hannes Käufler
Date: 2020-07-26T13:59:45-04:00
New Revision: 3bbf3e026d3c692966583075ae6d12c4575e9d72

URL: https://github.com/llvm/llvm-project/commit/3bbf3e026d3c692966583075ae6d12c4575e9d72
DIFF: https://github.com/llvm/llvm-project/commit/3bbf3e026d3c692966583075ae6d12c4575e9d72.diff

LOG: Replace comment by private method; NFC.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
index 68bb987c1275..1cae618dfd09 100644
--- a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -123,12 +123,7 @@ class HeaderGuardPPCallbacks : public PPCallbacks {
 
     // 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 @@ class HeaderGuardPPCallbacks : public PPCallbacks {
   }
 
 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>>


        


More information about the cfe-commits mailing list