Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ void Tokenizer::simplifyTypedef()
}

// check for typedef that can be substituted
else if ((tok2->isNameOnly() || (tok2->isName() && tok2->isExpandedMacro())) &&
else if ((tok2->isNameOnly() || (tok2->isName() && (tok2->isExpandedMacro() || tok2->isInline()))) &&
(Token::simpleMatch(tok2, pattern.c_str(), pattern.size()) ||
(inMemberFunc && tok2->str() == typeName->str()))) {
// member function class variables don't need qualification
Expand Down
9 changes: 7 additions & 2 deletions test/testsimplifytypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,14 +397,19 @@ class TestSimplifyTypedef : public TestFixture {
" typedef float float_t ;\n"
" inline VL::float_t fast_atan2(VL::float_t y, VL::float_t x){}\n"
"}";

const char expected[] =
"namespace VL { "
""
"float fast_atan2 ( float y , float x ) { } "
"}";

ASSERT_EQUALS(expected, tok(code, false));

// ticket #11373
const char code1[] =
"typedef int foo;\n"
"inline foo f();\n";
const char expected1[] = "int f ( ) ;";
ASSERT_EQUALS(expected1, tok(code1, false));
}

void simplifyTypedef7() {
Expand Down