[clang] 34fba4f - [Basic] Use StringRef::contains (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 3 21:43:19 PST 2024


Author: Kazu Hirata
Date: 2024-02-03T21:43:06-08:00
New Revision: 34fba4fb1e32f06237e5024373cc0163cecc3fd5

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

LOG: [Basic] Use StringRef::contains (NFC)

Added: 
    

Modified: 
    clang/lib/Basic/Sarif.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Sarif.cpp b/clang/lib/Basic/Sarif.cpp
index 1cae7b937bc6e..8c144df341673 100644
--- a/clang/lib/Basic/Sarif.cpp
+++ b/clang/lib/Basic/Sarif.cpp
@@ -57,8 +57,7 @@ static std::string percentEncodeURICharacter(char C) {
   // should be written out directly. Otherwise, percent
   // encode the character and write that out instead of the
   // reserved character.
-  if (llvm::isAlnum(C) ||
-      StringRef::npos != StringRef("-._~:@!$&'()*+,;=").find(C))
+  if (llvm::isAlnum(C) || StringRef("-._~:@!$&'()*+,;=").contains(C))
     return std::string(&C, 1);
   return "%" + llvm::toHex(StringRef(&C, 1));
 }


        


More information about the cfe-commits mailing list