steveire created this revision.
steveire added a reviewer: njames93.
steveire requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
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())
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())
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits