[clang] 0f97cd8 - [Frontend] Use StringRef::ends_with (NFC) (#135988)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 16 12:29:07 PDT 2025


Author: Kazu Hirata
Date: 2025-04-16T12:29:04-07:00
New Revision: 0f97cd87dee1ddc6aadc04369262739da2f55b5a

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

LOG: [Frontend] Use StringRef::ends_with (NFC) (#135988)

Added: 
    

Modified: 
    clang/lib/Frontend/InitPreprocessor.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 659af42478991..1f297f228fc1b 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -32,7 +32,7 @@ using namespace clang;
 static bool MacroBodyEndsInBackslash(StringRef MacroBody) {
   while (!MacroBody.empty() && isWhitespace(MacroBody.back()))
     MacroBody = MacroBody.drop_back();
-  return !MacroBody.empty() && MacroBody.back() == '\\';
+  return MacroBody.ends_with('\\');
 }
 
 // Append a #define line to Buf for Macro.  Macro should be of the form XXX,


        


More information about the cfe-commits mailing list