Skip to content

Commit 10bab82

Browse files
authored
Fix #13358: Add 'isFriend' to DumpFile (danmar#7224)
1 parent bb81a66 commit 10bab82

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

lib/symboldatabase.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,6 +4267,8 @@ void SymbolDatabase::printXml(std::ostream &out) const
42674267
outs += " isInlineKeyword=\"true\"";
42684268
if (function->isStatic())
42694269
outs += " isStatic=\"true\"";
4270+
if (function->isFriend())
4271+
outs += " isFriend=\"true\"";
42704272
if (function->isAttributeNoreturn())
42714273
outs += " isAttributeNoreturn=\"true\"";
42724274
if (const Function* overriddenFunction = function->getOverriddenFunction()) {

test/testsymboldatabase.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,8 @@ class TestSymbolDatabase : public TestFixture {
607607
TEST_CASE(incomplete_type); // #9255 (infinite recursion)
608608
TEST_CASE(exprIds);
609609
TEST_CASE(testValuetypeOriginalName);
610+
611+
TEST_CASE(dumpFriend); // Check if isFriend added to dump file
610612
}
611613

612614
void array() {
@@ -11073,6 +11075,19 @@ class TestSymbolDatabase : public TestFixture {
1107311075
ASSERT(tok->valueType()->constness == 0);
1107411076
}
1107511077
}
11078+
11079+
void dumpFriend() {
11080+
GET_SYMBOL_DB("class Foo {\n"
11081+
" Foo();\n"
11082+
" int x{};\n"
11083+
" friend bool operator==(const Foo&lhs, const Foo&rhs) {\n"
11084+
" return lhs.x == rhs.x;\n"
11085+
" }\n"
11086+
"};");
11087+
std::ostringstream ostr;
11088+
db->printXml(ostr);
11089+
ASSERT(ostr.str().find(" isFriend=\"true\"") != std::string::npos);
11090+
}
1107611091
};
1107711092

1107811093
REGISTER_TEST(TestSymbolDatabase)

0 commit comments

Comments
 (0)