diff --git a/clang/lib/Tooling/NodeIntrospection.cpp b/clang/lib/Tooling/NodeIntrospection.cpp --- a/clang/lib/Tooling/NodeIntrospection.cpp +++ b/clang/lib/Tooling/NodeIntrospection.cpp @@ -44,9 +44,6 @@ bool RangeLessThan::operator()( std::pair const &LHS, std::pair const &RHS) const { - if (!LHS.first.isValid() || !RHS.first.isValid()) - return false; - if (LHS.first.getBegin() < RHS.first.getBegin()) return true; else if (LHS.first.getBegin() != RHS.first.getBegin()) diff --git a/clang/unittests/Introspection/IntrospectionTest.cpp b/clang/unittests/Introspection/IntrospectionTest.cpp --- a/clang/unittests/Introspection/IntrospectionTest.cpp +++ b/clang/unittests/Introspection/IntrospectionTest.cpp @@ -91,6 +91,20 @@ EXPECT_EQ(slm.size(), 2u); } +TEST(Introspection, SourceLocations_CallContainer2) { + SourceRangeMap slm; + SharedLocationCall Prefix; + slm.insert( + std::make_pair(SourceRange(), llvm::makeIntrusiveRefCnt( + Prefix, "getCXXOperatorNameRange"))); + EXPECT_EQ(slm.size(), 1u); + + slm.insert(std::make_pair( + SourceRange(), + llvm::makeIntrusiveRefCnt(Prefix, "getSourceRange"))); + EXPECT_EQ(slm.size(), 2u); +} + TEST(Introspection, SourceLocations_CallChainFormatting) { SharedLocationCall Prefix; auto chainedCall = llvm::makeIntrusiveRefCnt(