Skip to content

Commit

Permalink
Allow empty offset class
Browse files Browse the repository at this point in the history
M	include/vara/Feature/FeatureSourceRange.h
M	unittests/Feature/FeatureSourceRange.cpp
  • Loading branch information
s9latimm committed Sep 4, 2023
1 parent c6374ff commit 387e0cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/vara/Feature/FeatureSourceRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ class FeatureSourceRange {

static llvm::SmallVector<llvm::StringRef, 1>
splitClass(llvm::StringRef Class) {
if (Class.empty()) {
return {};
}
llvm::SmallVector<llvm::StringRef, 1> Split;
Class.split(Split, "::");
return Split;
Expand Down
2 changes: 2 additions & 0 deletions unittests/Feature/FeatureSourceRange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ TEST(FeatureMemberOffset, individualAccessors) {
EXPECT_EQ(Member.value().className(0), "bar");
EXPECT_EQ(Member.value().className(1), "foo");
EXPECT_EQ(Member.value().memberName(), "member");
EXPECT_EQ(Member.value().nestingDepth(), 2);
}

TEST(FeatureMemberOffset, anonymous) {
Expand All @@ -143,6 +144,7 @@ TEST(FeatureMemberOffset, anonymous) {
EXPECT_EQ(Member->toString(), "::member");
EXPECT_EQ(Member.value().className(), "");
EXPECT_EQ(Member.value().memberName(), "member");
EXPECT_EQ(Member.value().nestingDepth(), 0);
}

TEST(FeatureMemberOffset, comparison) {
Expand Down

0 comments on commit 387e0cb

Please sign in to comment.