- fix: macro defines parsed before not correctly applied in the succeeding parse.

This commit is contained in:
Roy Qu 2022-11-08 22:04:53 +08:00
parent 6fe1df8e6e
commit 4fad826899
3 changed files with 7 additions and 9 deletions

View File

@ -9,6 +9,7 @@ Red Panda C++ Version 2.4
- enhancement: Rename filenames in todos/bookmarks/breakpoints when renaming project file
- enhancement: Rename filenames in bookmarks/breakpoints after a file is save-ased.
- fix: Can't goto definition of classes and namespaces displayed in the class browser on whole project mode.
- fix: macro defines parsed before not correctly applied in the succeeding parse.
Red Panda C++ Version 2.3

View File

@ -159,14 +159,6 @@ PDefine CppPreprocessor::getHardDefine(const QString &name)
return mHardDefines.value(name,PDefine());
}
void CppPreprocessor::resetDefines()
{
mDefines = mHardDefines;
// mDefines.clear();
// mDefines.insert(mHardDefines);
}
void CppPreprocessor::setScanOptions(bool parseSystem, bool parseLocal)
{
mParseSystem = parseSystem;
@ -846,6 +838,7 @@ void CppPreprocessor::addDefinesInFile(const QString &fileName)
return;
mProcessed.insert(fileName);
qDebug()<<fileName;
// then add the defines defined in it
PDefineMap defineList = mFileDefines.value(fileName, PDefineMap());
if (defineList) {
@ -853,6 +846,11 @@ void CppPreprocessor::addDefinesInFile(const QString &fileName)
mDefines.insert(define->name,define);
}
}
PFileIncludes fileIncludes = getFileIncludesEntry(fileName);
foreach (const QString& file, fileIncludes->includeFiles.keys()) {
addDefinesInFile(file);
}
}
void CppPreprocessor::parseArgs(PDefine define)

View File

@ -121,7 +121,6 @@ private:
// include stuff
PFileIncludes getFileIncludesEntry(const QString& FileName);
void addDefinesInFile(const QString& fileName);
void resetDefines();
void addDefineByParts(const QString& name, const QString& args,
const QString& value, bool hardCoded);
void addDefineByLine(const QString& line, bool hardCoded);