fix: "__max" in istream.tcc is wrongly expanded.

This commit is contained in:
Roy Qu 2023-07-03 18:21:33 +08:00
parent f4b61d5c5a
commit 0e1332dd5e
2 changed files with 15 additions and 6 deletions

View File

@ -4081,7 +4081,7 @@ void CppParser::internalParse(const QString &fileName)
QStringList preprocessResult = mPreprocessor.result();
#ifdef QT_DEBUG
stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
// stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
// mPreprocessor.dumpDefinesTo("r:\\defines.txt");
// mPreprocessor.dumpIncludesListTo("r:\\includes.txt");
#endif
@ -4100,7 +4100,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;
@ -4113,8 +4113,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

@ -633,6 +633,8 @@ void CppPreprocessor::expandMacro(QString &newLine, QString &word, int &i, int d
else
newLine += word;
} else if (define && (define->args!="")) {
int origI=i;
int origIndex=mIndex;
while(true) {
while ((i<line.length()) && (line[i] == ' ' || line[i]=='\t'))
i++;
@ -682,6 +684,9 @@ void CppPreprocessor::expandMacro(QString &newLine, QString &word, int &i, int d
if (mIndex>=mBuffer.length())
break;
line = mBuffer[mIndex];
if (!inString && line.startsWith('#')) {
break;
}
} ;
if (level==0) {
argEnd = i-1;
@ -700,10 +705,14 @@ void CppPreprocessor::expandMacro(QString &newLine, QString &word, int &i, int d
// qDebug()<<args;
}
QString formattedValue = expandFunction(define,args);
if (define && define->name == "DEFHOOKPODX")
qDebug()<<formattedValue;
// if (define && define->name == "DEFHOOKPODX")
// qDebug()<<formattedValue;
newLine += expandMacros(formattedValue,depth+1);
}
} else {
newLine+=word;
i=origI;
mIndex=origIndex;
}
} else {
newLine += word;