[clang-tools-extra] 2699c1d - [clang-tidy] Use StringRef::starts_with (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 30 22:12:19 PST 2024


Author: Kazu Hirata
Date: 2024-01-30T22:12:08-08:00
New Revision: 2699c1d7007ea8001bfaae50de01ff33791ce958

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

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

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
index 7a06df454be99..f6714d056518d 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ReservedIdentifierCheck.cpp
@@ -104,7 +104,7 @@ static std::optional<std::string> getUnderscoreCapitalFixup(StringRef Name) {
 static bool startsWithUnderscoreInGlobalNamespace(StringRef Name,
                                                   bool IsInGlobalNamespace,
                                                   bool IsMacro) {
-  return !IsMacro && IsInGlobalNamespace && !Name.empty() && Name[0] == '_';
+  return !IsMacro && IsInGlobalNamespace && Name.starts_with("_");
 }
 
 static std::optional<std::string>


        


More information about the cfe-commits mailing list