From 58b92a636041b7fdd667d32debca366cf4b78fe5 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 1 Jul 2023 13:41:27 +0800 Subject: [PATCH] - fix: crash when source files contains macro definitions like "#define cfun (cfun + 0)" --- NEWS.md | 1 + RedPandaIDE/parser/cppparser.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d8c75e58..31d9c7db 100644 --- a/NEWS.md +++ b/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 diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 395774ac..81f398df 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -4904,10 +4904,10 @@ PEvalStatement CppParser::doEvalTerm(const QString &fileName, result = doCreateEvalFunction(fileName,statement); break; case StatementKind::skPreprocessor: - //qDebug()<<"before"<command) + phraseExpression.insert(pos+i,token); + else + phraseExpression.insert(pos+i,token+"_expanded"); + i++; + break; default: phraseExpression.insert(pos+i,token); i++;