From bb2532a2ef89660d73b8068faadabdd7003568f0 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 30 Nov 2022 09:54:23 +0800 Subject: [PATCH] - change: Default value of option "Editors share one code analyzer" is ON - change: Default value of option "Auto clear symbols in hidden editors" is OFF - minor fix --- NEWS.md | 4 +-- RedPandaIDE/parser/cppparser.cpp | 14 ++++++----- RedPandaIDE/parser/cppparser.h | 4 +-- RedPandaIDE/settings.cpp | 42 ++++++++++++++++---------------- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5d3befb8..9d8d815e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,8 +6,8 @@ Red Panda C++ Version 2.5 - enhancement: project's custom compile include/lib/bin directory is under folder of the app, save them using the path relative to the app - enhancement: slightly reduce memory usage - enhancement: Options -> editor -> custom C/C++ type keywords page - - change: Default value of option "Editors share one code analyzer" is ON if available physical memory <= 32G - - change: Default value of option "Auto clear symbols in hidden editors" is ON if number of CPU cores > 8 and "Editors share one code analyzer" is on + - change: Default value of option "Editors share one code analyzer" is ON + - change: Default value of option "Auto clear symbols in hidden editors" is OFF - enhancement: show completion suggest for "namespace" after "using" - fix: MinGW-w64 gcc displayed as "MinGW GCC" - enhancement: Deduce type info for "auto" in some simple cases for stl containers. diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 11aa233b..281e0180 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1068,10 +1068,11 @@ QString CppParser::prettyPrintStatement(const PStatement& statement, const QStri return result; } -QString CppParser::getFirstTemplateParam(const PStatement& statement, - const QString& filename, - const QString& phrase, - const PStatement& currentScope) +QString CppParser::getTemplateParam(const PStatement& statement, + const QString& filename, + const QString& phrase, + int index, + const PStatement& currentScope) { if (!statement) return ""; @@ -1079,7 +1080,7 @@ QString CppParser::getFirstTemplateParam(const PStatement& statement, return ""; if (statement->type == phrase) // prevent infinite loop return ""; - return findFirstTemplateParamOf(filename,statement->type, currentScope); + return doFindTemplateParamOf(filename,statement->type,index,currentScope); } int CppParser::getTemplateParamStart(const QString &s, int startAt, int index) @@ -2042,7 +2043,7 @@ QString CppParser::doFindTemplateParamOf(const QString &fileName, const QString PStatement scopeStatement = currentScope; PStatement statement = findStatementOf(fileName,s,currentScope); - return getFirstTemplateParam(statement,fileName, phrase, currentScope); + return getTemplateParam(statement,fileName, phrase,index, currentScope); } int CppParser::getCurrentBlockEndSkip() @@ -3248,6 +3249,7 @@ void CppParser::handleStructs(bool isTypedef) // normal class/struct decl } else { + bool templateSpecialization=false; PStatement firstSynonym; // Add class/struct name BEFORE opening brace if (mTokenizer[mIndex]->text.front() != '{') { diff --git a/RedPandaIDE/parser/cppparser.h b/RedPandaIDE/parser/cppparser.h index a95544c3..49aa277b 100644 --- a/RedPandaIDE/parser/cppparser.h +++ b/RedPandaIDE/parser/cppparser.h @@ -410,8 +410,8 @@ private: int getCurrentBlockEndSkip(); int getCurrentInlineNamespaceEndSkip(); PStatement getCurrentScope(); // gets last item from last level - QString getFirstTemplateParam(const PStatement& statement, const QString& filename, - const QString& phrase, const PStatement& currentScope); + QString getTemplateParam(const PStatement& statement, const QString& filename, + const QString& phrase, int index, const PStatement& currentScope); int getTemplateParamStart(const QString& s, int startAt, int index); int getTemplateParamEnd(const QString& s, int startAt); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 0714b286..39adeba0 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -4002,31 +4002,31 @@ void Settings::CodeCompletion::doLoad() bool shouldShare= true; bool doClear = false; -#ifdef Q_OS_WIN - MEMORYSTATUSEX statex; +//#ifdef Q_OS_WIN +// MEMORYSTATUSEX statex; - statex.dwLength = sizeof (statex); +// statex.dwLength = sizeof (statex); - GlobalMemoryStatusEx (&statex); +// GlobalMemoryStatusEx (&statex); - if (statex.ullAvailPhys > (long long int)24*1024*1024*1024) { - shouldShare = false; - } +// if (statex.ullAvailPhys > (long long int)32*1024*1024*1024) { +// shouldShare = false; +// } - if (shouldShare) { - SYSTEM_INFO info; - GetSystemInfo(&info); - if (info.dwNumberOfProcessors>8 && info.dwProcessorType) { - doClear = true; - } - } -#elif defined(Q_OS_LINUX) - struct sysinfo si; - sysinfo(&si); - if (si.freeram > (long long int)24*1024*1024*1024) { - shouldShare = false; - } -#endif +//// if (shouldShare) { +//// SYSTEM_INFO info; +//// GetSystemInfo(&info); +//// if (info.dwNumberOfProcessors>8 && info.dwProcessorType) { +//// doClear = true; +//// } +//// } +//#elif defined(Q_OS_LINUX) +// struct sysinfo si; +// sysinfo(&si); +// if (si.freeram > (long long int)24*1024*1024*1024) { +// shouldShare = false; +// } +//#endif mClearWhenEditorHidden = boolValue("clear_when_editor_hidden",doClear); mShareParser = boolValue("share_parser",shouldShare); }