- fix: C++ compiler atrribute '[[xxx]]' are not correctly handled.

This commit is contained in:
Roy Qu 2023-10-25 17:01:42 +08:00
parent 85ef5986bf
commit 3a78819fb8
6 changed files with 30 additions and 19 deletions

View File

@ -17,6 +17,8 @@ Red Panda C++ Version 2.26
- enhancement: Basic support for parsing variadic macros(macros that use __VA_ARGS__).
- enhancement: Better support for expanding macros with complex parameters.
- fix: Macros that defined by the compiler are not correctly syntax-colored and tooltiped.
- fix: Code suggestion for identifiers after '*' (eg. 3 * item->price) can't correct.
- fix: C++ compiler atrribute '[[xxx]]' are not correctly handled.
Red Panda C++ Version 2.25

View File

@ -15,7 +15,7 @@ APP_NAME = RedPandaCPP
APP_VERSION = 2.26
TEST_VERSION = alpha4
TEST_VERSION = alpha5
contains(QMAKE_HOST.arch, x86_64):{
DEFINES += ARCH_X86_64=1

View File

@ -2319,9 +2319,16 @@ QStringList Editor::getExpressionAtPosition(
break;
case LastSymbolType::AsteriskSign: // before '*':
if (token == '*') {
} else
} else {
QChar ch=token.front();
if (isIdentChar(ch)
|| ch.isDigit()
|| ch == '.'
|| ch == ')' ) {
result.pop_front();
}
return result;
}
break;
case LastSymbolType::AmpersandSign: // before '&':
return result;

View File

@ -4397,8 +4397,8 @@ void CppParser::internalParse(const QString &fileName)
QStringList preprocessResult = mPreprocessor.result();
#ifdef QT_DEBUG
// stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
// mPreprocessor.dumpDefinesTo("r:\\defines.txt");
stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
mPreprocessor.dumpDefinesTo("r:\\defines.txt");
// mPreprocessor.dumpIncludesListTo("r:\\includes.txt");
#endif
//qDebug()<<"preprocess"<<timer.elapsed();
@ -4416,7 +4416,7 @@ void CppParser::internalParse(const QString &fileName)
if (mTokenizer.tokenCount() == 0)
return;
#ifdef QT_DEBUG
// mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
#endif
#ifdef QT_DEBUG
mLastIndex = -1;
@ -4429,8 +4429,8 @@ void CppParser::internalParse(const QString &fileName)
}
// qDebug()<<"parse"<<timer.elapsed();
#ifdef QT_DEBUG
// mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
// mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
#endif
//reduce memory usage
internalClear();

View File

@ -485,6 +485,7 @@ QString CppTokenizer::getWord()
skipToNextToken();
}
} else if (*mCurrent == '[') {
if (*(mCurrent+1)!='[') {
// Append array stuff
while(true) {
offset = mCurrent;
@ -496,6 +497,7 @@ QString CppTokenizer::getWord()
break;
}
}
}
// Keep parent/child operators
// if (*mCurrent == '.') {

View File

@ -21,7 +21,7 @@ APP_NAME = RedPandaCPP
APP_VERSION = 2.26
TEST_VERSION = alpha1
TEST_VERSION = alpha5
win32: {
SUBDIRS += \