File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -1794,7 +1794,7 @@ void Tokenizer::simplifyTypedefCpp()
1794
1794
}
1795
1795
1796
1796
// check for typedef that can be substituted
1797
- else if ((tok2->isNameOnly() || (tok2->isName() && (tok2->isExpandedMacro() || tok2->isInline()))) &&
1797
+ else if ((tok2->isNameOnly() || (tok2->isName() && (tok2->isExpandedMacro() || tok2->isInline() || tok2->isExternC() ))) &&
1798
1798
(Token::simpleMatch(tok2, pattern.c_str(), pattern.size()) ||
1799
1799
(inMemberFunc && tok2->str() == typeName->str()))) {
1800
1800
// member function class variables don't need qualification
Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ class TestSimplifyTypedef : public TestFixture {
219
219
TEST_CASE (simplifyTypedef152);
220
220
TEST_CASE (simplifyTypedef153);
221
221
TEST_CASE (simplifyTypedef154);
222
+ TEST_CASE (simplifyTypedef155);
222
223
223
224
TEST_CASE (simplifyTypedefFunction1);
224
225
TEST_CASE (simplifyTypedefFunction2); // ticket #1685
@@ -3614,6 +3615,15 @@ class TestSimplifyTypedef : public TestFixture {
3614
3615
ASSERT_EQUALS (exp , tok (code));
3615
3616
}
3616
3617
3618
+ void simplifyTypedef155 () {
3619
+ const char code[] = " typedef struct S T;\n " // #12808
3620
+ " typedef struct S { int i; } T;\n "
3621
+ " extern \" C\" void f(T* t);\n " ;
3622
+ const char exp [] = " struct S { int i ; } ; "
3623
+ " void f ( struct S * t ) ;" ;
3624
+ ASSERT_EQUALS (exp , tok (code));
3625
+ }
3626
+
3617
3627
void simplifyTypedefFunction1 () {
3618
3628
{
3619
3629
const char code[] = " typedef void (*my_func)();\n "
You can’t perform that action at this time.
0 commit comments