- fix: crash when source files contains macro definitions like "#define cfun (cfun + 0)"
This commit is contained in:
parent
88b592f829
commit
58b92a6360
1
NEWS.md
1
NEWS.md
|
@ -19,6 +19,7 @@ Red Panda C++ Version 2.23
|
|||
- enhancement: correctly highlight multiline raw string literals.
|
||||
- change: remove "Assembly" color scheme item (it's not used anymore).
|
||||
- fix: crash when parsing files containing inline assembly code.
|
||||
- fix: crash when source files contains macro definitions like "#define cfun (cfun + 0)"
|
||||
|
||||
Red Panda C++ Version 2.22
|
||||
|
||||
|
|
|
@ -4904,10 +4904,10 @@ PEvalStatement CppParser::doEvalTerm(const QString &fileName,
|
|||
result = doCreateEvalFunction(fileName,statement);
|
||||
break;
|
||||
case StatementKind::skPreprocessor:
|
||||
//qDebug()<<"before"<<phraseExpression;
|
||||
// qDebug()<<"before"<<phraseExpression;
|
||||
pos--;
|
||||
if (expandMacro(phraseExpression,pos,statement)) {
|
||||
//qDebug()<<"after"<<phraseExpression;
|
||||
// qDebug()<<"after"<<phraseExpression;
|
||||
result = doEvalExpression(fileName,phraseExpression,pos,scope,previousResult,freeScoped);
|
||||
} else
|
||||
result = PEvalStatement();
|
||||
|
@ -5068,6 +5068,13 @@ bool CppParser::expandMacro(QStringList &phraseExpression, int &pos, const PStat
|
|||
case QSynedit::TokenType::Space:
|
||||
case QSynedit::TokenType::Comment:
|
||||
break;
|
||||
case QSynedit::TokenType::Identifier:
|
||||
if (token!=macro->command)
|
||||
phraseExpression.insert(pos+i,token);
|
||||
else
|
||||
phraseExpression.insert(pos+i,token+"_expanded");
|
||||
i++;
|
||||
break;
|
||||
default:
|
||||
phraseExpression.insert(pos+i,token);
|
||||
i++;
|
||||
|
|
Loading…
Reference in New Issue