[flang-commits] [flang] ab9a698 - [flang] Simplify a string comparison (NFC)

Kazu Hirata via flang-commits flang-commits at lists.llvm.org
Sat Feb 3 09:36:54 PST 2024


Author: Kazu Hirata
Date: 2024-02-03T09:36:43-08:00
New Revision: ab9a69878c7a14b85389c16e130ea117ee4f4358

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

LOG: [flang] Simplify a string comparison (NFC)

Added: 
    

Modified: 
    flang/lib/Parser/preprocessor.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp
index 10661dda32bc3..4c2bd31a2ae84 100644
--- a/flang/lib/Parser/preprocessor.cpp
+++ b/flang/lib/Parser/preprocessor.cpp
@@ -669,7 +669,7 @@ void Preprocessor::Directive(const TokenSequence &dir, Prescanner &prescanner) {
       TokenSequence braced{path, 1, k - 1};
       include = braced.ToString();
     } else if ((include.substr(0, 1) == "\"" || include.substr(0, 1) == "'") &&
-        include.substr(include.size() - 1, 1) == include.substr(0, 1)) {
+        include.front() == include.back()) {
       // #include "foo" and #include 'foo'
       include = include.substr(1, include.size() - 2);
       // Start search in directory of file containing the directive


        


More information about the flang-commits mailing list