[clang-tools-extra] 771ab15 - [clang-tidy] Use StringRef::ltrim (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 18:40:03 PST 2024


Author: Kazu Hirata
Date: 2024-01-12T18:39:51-08:00
New Revision: 771ab15e4881b9c4adaabb694d901c3dbeb1fa47

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

LOG: [clang-tidy] Use StringRef::ltrim (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 80580bc9888a8c..3540c496515bed 100644
--- a/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
+++ b/clang-tools-extra/clang-tidy/utils/HeaderGuard.cpp
@@ -281,7 +281,7 @@ void HeaderGuardCheck::registerPPCallbacks(const SourceManager &SM,
 
 std::string HeaderGuardCheck::sanitizeHeaderGuard(StringRef Guard) {
   // Only reserved identifiers are allowed to start with an '_'.
-  return Guard.drop_while([](char C) { return C == '_'; }).str();
+  return Guard.ltrim('_').str();
 }
 
 bool HeaderGuardCheck::shouldSuggestEndifComment(StringRef FileName) {


        


More information about the cfe-commits mailing list