[PATCH] D100723: [AST] Fix comparison to of SourceRanges in container
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 19 13:19:53 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG782c3e23ba09: [AST] Fix comparison to of SourceRanges in container (authored by stephenkelly).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100723/new/
https://reviews.llvm.org/D100723
Files:
clang/lib/Tooling/NodeIntrospection.cpp
clang/unittests/Introspection/IntrospectionTest.cpp
Index: clang/unittests/Introspection/IntrospectionTest.cpp
===================================================================
--- clang/unittests/Introspection/IntrospectionTest.cpp
+++ 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<LocationCall>(
+ Prefix, "getCXXOperatorNameRange")));
+ EXPECT_EQ(slm.size(), 1u);
+
+ slm.insert(std::make_pair(
+ SourceRange(),
+ llvm::makeIntrusiveRefCnt<LocationCall>(Prefix, "getSourceRange")));
+ EXPECT_EQ(slm.size(), 2u);
+}
+
TEST(Introspection, SourceLocations_CallChainFormatting) {
SharedLocationCall Prefix;
auto chainedCall = llvm::makeIntrusiveRefCnt<LocationCall>(
Index: clang/lib/Tooling/NodeIntrospection.cpp
===================================================================
--- clang/lib/Tooling/NodeIntrospection.cpp
+++ clang/lib/Tooling/NodeIntrospection.cpp
@@ -44,9 +44,6 @@
bool RangeLessThan::operator()(
std::pair<SourceRange, SharedLocationCall> const &LHS,
std::pair<SourceRange, SharedLocationCall> 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())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100723.338617.patch
Type: text/x-patch
Size: 1505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210419/ab5bff58/attachment.bin>
More information about the cfe-commits
mailing list