[llvm-branch-commits] [clang-tools-extra] d99da80 - [clangd] Fix path edge-case condition.

Sam McCall via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Nov 29 04:44:32 PST 2020


Author: Sam McCall
Date: 2020-11-29T13:40:29+01:00
New Revision: d99da80841cb4d9734db4a48cd49e37b623176bc

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

LOG: [clangd] Fix path edge-case condition.

Added: 
    

Modified: 
    clang-tools-extra/clangd/ConfigProvider.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ConfigProvider.cpp b/clang-tools-extra/clangd/ConfigProvider.cpp
index e020ec04d1d2..8a3991ed1c1e 100644
--- a/clang-tools-extra/clangd/ConfigProvider.cpp
+++ b/clang-tools-extra/clangd/ConfigProvider.cpp
@@ -103,7 +103,7 @@ Provider::fromAncestorRelativeYAMLFiles(llvm::StringRef RelPath,
            I != E; ++I) {
         // Avoid weird non-substring cases like phantom "." components.
         // In practice, Component is a substring for all "normal" ancestors.
-        if (I->end() < Parent.begin() && I->end() > Parent.end())
+        if (I->end() < Parent.begin() || I->end() > Parent.end())
           continue;
         Ancestors.emplace_back(Parent.begin(), I->end() - Parent.begin());
       }


        


More information about the llvm-branch-commits mailing list