[llvm] b153e01 - [Support] Simplify control flow in percentDecode (NFC) (#165134)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Oct 26 08:20:24 PDT 2025
    
    
  
Author: Kazu Hirata
Date: 2025-10-26T08:20:20-07:00
New Revision: b153e01f83ffbfb929734bb450e34d27bea2b789
URL: https://github.com/llvm/llvm-project/commit/b153e01f83ffbfb929734bb450e34d27bea2b789
DIFF: https://github.com/llvm/llvm-project/commit/b153e01f83ffbfb929734bb450e34d27bea2b789.diff
LOG: [Support] Simplify control flow in percentDecode (NFC) (#165134)
The "if" statement being removed in this patch is identical to the
"else" clause.
Added: 
    
Modified: 
    llvm/lib/Support/LSP/Protocol.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/lib/Support/LSP/Protocol.cpp b/llvm/lib/Support/LSP/Protocol.cpp
index f22126345a435..f8eeb32db02ab 100644
--- a/llvm/lib/Support/LSP/Protocol.cpp
+++ b/llvm/lib/Support/LSP/Protocol.cpp
@@ -96,10 +96,6 @@ static void percentEncode(StringRef Content, std::string &Out) {
 static std::string percentDecode(StringRef Content) {
   std::string Result;
   for (auto I = Content.begin(), E = Content.end(); I != E; ++I) {
-    if (*I != '%') {
-      Result += *I;
-      continue;
-    }
     if (*I == '%' && I + 2 < Content.end() && llvm::isHexDigit(*(I + 1)) &&
         llvm::isHexDigit(*(I + 2))) {
       Result.push_back(llvm::hexFromNibbles(*(I + 1), *(I + 2)));
        
    
    
More information about the llvm-commits
mailing list