[clang-tools-extra] bc27f35 - [clang-tidy] Use StringRef::consume_front (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 14 12:18:02 PST 2024


Author: Kazu Hirata
Date: 2024-01-14T12:17:52-08:00
New Revision: bc27f3573d61012771aa3fee2427f0dd5b8a1288

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

LOG: [clang-tidy] Use StringRef::consume_front (NFC)

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/GlobList.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/GlobList.cpp b/clang-tools-extra/clang-tidy/GlobList.cpp
index 694db35106fd63..dfe3f7c505b174 100644
--- a/clang-tools-extra/clang-tidy/GlobList.cpp
+++ b/clang-tools-extra/clang-tidy/GlobList.cpp
@@ -16,11 +16,7 @@ namespace clang::tidy {
 // from the GlobList.
 static bool consumeNegativeIndicator(StringRef &GlobList) {
   GlobList = GlobList.trim();
-  if (GlobList.starts_with("-")) {
-    GlobList = GlobList.substr(1);
-    return true;
-  }
-  return false;
+  return GlobList.consume_front("-");
 }
 
 // Converts first glob from the comma-separated list of globs to Regex and


        


More information about the cfe-commits mailing list