- fix: "typedef struct" that don't have definition of the struct is not correctly parsed.
This commit is contained in:
parent
dce377d6d2
commit
d71cd7e7dc
1
NEWS.md
1
NEWS.md
|
@ -15,6 +15,7 @@ Red Panda C++ Version 2.23
|
|||
- enhancement: Support debug executable files generated by mingw-w64 gcc 13.1 and filepath contains non-ascii chars.
|
||||
- enhancement: When deleteing files in the files/project view, try moving to the trash bin instead.
|
||||
- fix: GNU assembly files (.s) are not shown in the files view.
|
||||
- fix: "typedef struct" that don't have definition of the struct is not correctly parsed.
|
||||
|
||||
Red Panda C++ Version 2.22
|
||||
|
||||
|
|
|
@ -3368,16 +3368,21 @@ void CppParser::handleStructs(bool isTypedef)
|
|||
// typdef struct Foo Bar
|
||||
if (isTypedef) {
|
||||
QString oldType = mTokenizer[mIndex]->text;
|
||||
QString tempType = "";
|
||||
bool isFirstLoop=true;
|
||||
while(true) {
|
||||
// Add definition statement for the synonym
|
||||
if ((mIndex + 1 < tokenCount)
|
||||
&& (mTokenizer[mIndex + 1]->text==","
|
||||
|| mTokenizer[mIndex + 1]->text==";")) {
|
||||
QString newType = mTokenizer[mIndex]->text;
|
||||
QString type=oldType;
|
||||
if (!tempType.isEmpty())
|
||||
type+=tempType;
|
||||
addStatement(
|
||||
getCurrentScope(),
|
||||
mCurrentFile,
|
||||
oldType,
|
||||
type,
|
||||
newType,
|
||||
"", // args
|
||||
"", // noname args
|
||||
|
@ -3387,7 +3392,10 @@ void CppParser::handleStructs(bool isTypedef)
|
|||
getScope(),
|
||||
mCurrentMemberAccessibility,
|
||||
StatementProperty::spHasDefinition);
|
||||
}
|
||||
tempType="";
|
||||
} else if (!isFirstLoop)
|
||||
tempType+= mTokenizer[mIndex]->text;
|
||||
isFirstLoop=false;
|
||||
mIndex++;
|
||||
if (mIndex >= tokenCount)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue