- fix: Can't correctly parse function pointer var definition.
This commit is contained in:
parent
683331e848
commit
56972d168e
2
NEWS.md
2
NEWS.md
|
@ -4,10 +4,12 @@ Red Panda C++ Version 2.16
|
|||
- enhancement: Improve support for function pointer typedefs.
|
||||
- fix: Can't debug project when project is saved after it's compiled.
|
||||
- fix: Icons for buttons in the cpu info dialog is not correctly set.
|
||||
- fix: Can't locate the corresponding line in the generated asm file under linux.
|
||||
- enhancement: Add cfi directives for asm syntaxer in linux.
|
||||
- change: Editor option "Scroll past end of line" default to false.
|
||||
- emhancement: Improve display of disassembled codes in the cpu info dialog.
|
||||
- change: Set optimization level to -Og for Debug compiler settings by default.
|
||||
- fix: Can't correctly parse function pointer var definition.
|
||||
|
||||
Red Panda C++ Version 2.15
|
||||
|
||||
|
|
|
@ -60,12 +60,12 @@ void CompilerInfo::prepareCompilerOptions()
|
|||
groupName = QObject::tr("Code Generation");
|
||||
// Optimization
|
||||
sl.clear();
|
||||
sl.append(QPair<QString,QString>("Low","1"));
|
||||
sl.append(QPair<QString,QString>("Med","2"));
|
||||
sl.append(QPair<QString,QString>("High","3"));
|
||||
sl.append(QPair<QString,QString>("Highest (fast)","fast"));
|
||||
sl.append(QPair<QString,QString>("Size (s)","s"));
|
||||
sl.append(QPair<QString,QString>("Debug (g)","g"));
|
||||
sl.append(QPair<QString,QString>("Low (-O1)","1"));
|
||||
sl.append(QPair<QString,QString>("Med (-O2)","2"));
|
||||
sl.append(QPair<QString,QString>("High (-O3)","3"));
|
||||
sl.append(QPair<QString,QString>("Highest (-Ofast)","fast"));
|
||||
sl.append(QPair<QString,QString>("Size (-Os)","s"));
|
||||
sl.append(QPair<QString,QString>("Debug (-Og)","g"));
|
||||
addOption(CC_CMD_OPT_OPTIMIZE, QObject::tr("Optimization level (-Ox)"), groupName, true, true, false, "-O", sl);
|
||||
|
||||
// C++ Language Standards
|
||||
|
|
|
@ -1719,10 +1719,12 @@ void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
|
|||
return;
|
||||
}
|
||||
QString currentText=mTokenizer[mIndex]->text;
|
||||
bool declAuto=false;
|
||||
if (keywordType==KeywordType::DeclType) {
|
||||
if (mTokenizer[mIndex+1]->text=='(') {
|
||||
currentText="auto";
|
||||
mIndex=mTokenizer[mIndex+1]->matchIndex+1;
|
||||
declAuto=true;
|
||||
} else {
|
||||
currentText=mTokenizer[mIndex+1]->text;
|
||||
mIndex+=2;
|
||||
|
@ -1742,14 +1744,10 @@ void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
|
|||
handleMethod(StatementKind::skFunction,"",
|
||||
mergeArgs(mIndex+1,mTokenizer[mIndex]->matchIndex-1),
|
||||
indexAfterParentheis,false,false);
|
||||
// } else if (currentText.endsWith("::operator")) {
|
||||
// mIndex=indexAfterParentheis;
|
||||
// handleMethod(StatementKind::skFunction,"",
|
||||
// mergeArgs(mIndex+1,mTokenizer[mIndex]->matchIndex-1),
|
||||
// indexAfterParentheis,false,false);
|
||||
} else {
|
||||
//function pointer var
|
||||
handleVar(currentText,false,false);
|
||||
mIndex--;
|
||||
handleVar("",false,false);
|
||||
}
|
||||
} else {
|
||||
if (currentText=="operator") {
|
||||
|
@ -3602,7 +3600,8 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
|
|||
}
|
||||
} else if (mTokenizer[mIndex]->text==';') {
|
||||
break;
|
||||
} else if (isIdentChar(mTokenizer[mIndex]->text[0])) {
|
||||
} else if (isIdentChar(mTokenizer[mIndex]->text[0])
|
||||
|| mTokenizer[mIndex]->text[0]==')') { //decltype(auto)
|
||||
QString cmd=mTokenizer[mIndex]->text;
|
||||
if (mIndex+1< mTokenizer.tokenCount() && mTokenizer[mIndex+1]->text=='('
|
||||
&& mTokenizer[mIndex+1]->matchIndex+1<mTokenizer.tokenCount()
|
||||
|
@ -3615,10 +3614,22 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
|
|||
|
||||
if (!cmd.isEmpty()) {
|
||||
QString type=lastType;
|
||||
QString s1=mTokenizer[mIndex]->text;
|
||||
if (s1==")") // decltype(auto)
|
||||
s1="auto";
|
||||
if(type.endsWith("::"))
|
||||
type+=tempType;
|
||||
else
|
||||
type+=" "+tempType;
|
||||
if(type.endsWith("::"))
|
||||
type+=s1;
|
||||
else
|
||||
type+=" "+s1;
|
||||
|
||||
addedVar = addChildStatement(
|
||||
getCurrentScope(),
|
||||
mCurrentFile,
|
||||
(lastType+" "+tempType+" "+mTokenizer[mIndex]->text).trimmed(),
|
||||
type.trimmed(),
|
||||
cmd,
|
||||
mergeArgs(argStart,argEnd),
|
||||
"",
|
||||
|
|
Loading…
Reference in New Issue