- fix: parse error in avxintrin.h
- fix: infinite loop when searching for using alias
This commit is contained in:
parent
0fd70d7ab6
commit
47212c2716
1
NEWS.md
1
NEWS.md
|
@ -29,6 +29,7 @@ Red Panda C++ Version 1.0.0
|
||||||
- fix: wrong font size of exported RTF file
|
- fix: wrong font size of exported RTF file
|
||||||
- fix: correct tokenize statements like "using ::memcpy";
|
- fix: correct tokenize statements like "using ::memcpy";
|
||||||
- fix: wrong font size of exported HTML file
|
- fix: wrong font size of exported HTML file
|
||||||
|
- fix: parse error in avxintrin.h
|
||||||
|
|
||||||
Red Panda C++ Version 0.14.5
|
Red Panda C++ Version 0.14.5
|
||||||
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
- fix: the "gnu c++ 20" option in compiler set options is wrong
|
||||||
|
|
|
@ -485,8 +485,23 @@ PStatement CppParser::findAliasedStatement(const PStatement &statement)
|
||||||
return PStatement();
|
return PStatement();
|
||||||
if (!statement)
|
if (!statement)
|
||||||
return PStatement();
|
return PStatement();
|
||||||
return findTypeDefinitionOf(statement->fileName,statement->type, statement->parentScope.lock());
|
QString alias = statement->type;
|
||||||
|
int pos = statement->type.lastIndexOf("::");
|
||||||
|
if (pos<0)
|
||||||
|
return PStatement();
|
||||||
|
QString nsName=statement->type.mid(0,pos);
|
||||||
|
QString name = statement->type.mid(pos+2);
|
||||||
|
PStatementList namespaceStatements = findNamespace(nsName);
|
||||||
|
if (!namespaceStatements)
|
||||||
|
return PStatement();
|
||||||
|
foreach (const PStatement& namespaceStatement, *namespaceStatements) {
|
||||||
|
QList<PStatement> resultList = findMembersOfStatement(name,namespaceStatement);
|
||||||
|
foreach(const PStatement& resultStatement,resultList) {
|
||||||
|
if (resultStatement->kind != StatementKind::skAlias)
|
||||||
|
return resultStatement;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
PStatement CppParser::findStatementStartingFrom(const QString &fileName, const QString &phrase, const PStatement& startScope)
|
PStatement CppParser::findStatementStartingFrom(const QString &fileName, const QString &phrase, const PStatement& startScope)
|
||||||
|
@ -2485,10 +2500,10 @@ void CppParser::handleOtherTypedefs()
|
||||||
newType += mTokenizer[mIndex]->text + ' ';
|
newType += mTokenizer[mIndex]->text + ' ';
|
||||||
mIndex++;
|
mIndex++;
|
||||||
}
|
}
|
||||||
|
if (mIndex < mTokenizer.tokenCount() && mTokenizer[mIndex]->text[0] == ',' )
|
||||||
|
mIndex++;
|
||||||
if ((mIndex>= mTokenizer.tokenCount()) || (mTokenizer[mIndex]->text[0] == ';'))
|
if ((mIndex>= mTokenizer.tokenCount()) || (mTokenizer[mIndex]->text[0] == ';'))
|
||||||
break;
|
break;
|
||||||
else if (mTokenizer[mIndex]->text.front() == ',')
|
|
||||||
mIndex++;
|
|
||||||
if (mIndex+1 >= mTokenizer.tokenCount())
|
if (mIndex+1 >= mTokenizer.tokenCount())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3230,7 +3245,7 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
mPreprocessor.clearResult();
|
mPreprocessor.clearResult();
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// StringsToFile(mPreprocessor.result(),"z:\\preprocess.txt");
|
// stringsToFile(mPreprocessor.result(),"r:\\preprocess.txt");
|
||||||
// mPreprocessor.dumpDefinesTo("z:\\defines.txt");
|
// mPreprocessor.dumpDefinesTo("z:\\defines.txt");
|
||||||
// mPreprocessor.dumpIncludesListTo("z:\\includes.txt");
|
// mPreprocessor.dumpIncludesListTo("z:\\includes.txt");
|
||||||
#endif
|
#endif
|
||||||
|
@ -3251,9 +3266,9 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
internalClear();
|
internalClear();
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// mTokenizer.dumpTokens("z:\\tokens.txt");
|
mTokenizer.dumpTokens("r:\\tokens.txt");
|
||||||
// mStatementList.dump("z:\\stats.txt");
|
mStatementList.dump("r:\\stats.txt");
|
||||||
// mStatementList.dumpAll("z:\\all-stats.txt");
|
mStatementList.dumpAll("r:\\all-stats.txt");
|
||||||
#endif
|
#endif
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
mTokenizer.reset();
|
mTokenizer.reset();
|
||||||
|
@ -3370,6 +3385,30 @@ PStatement CppParser::findMemberOfStatement(const QString &phrase,
|
||||||
return statementMap.value(s,PStatement());
|
return statementMap.value(s,PStatement());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<PStatement> CppParser::findMembersOfStatement(const QString &phrase, const PStatement &scopeStatement)
|
||||||
|
{
|
||||||
|
const StatementMap& statementMap =mStatementList.childrenStatements(scopeStatement);
|
||||||
|
if (statementMap.isEmpty())
|
||||||
|
return QList<PStatement>();
|
||||||
|
|
||||||
|
QString s = phrase;
|
||||||
|
//remove []
|
||||||
|
int p = phrase.indexOf('[');
|
||||||
|
if (p>=0)
|
||||||
|
s.truncate(p);
|
||||||
|
//remove ()
|
||||||
|
p = phrase.indexOf('(');
|
||||||
|
if (p>=0)
|
||||||
|
s.truncate(p);
|
||||||
|
|
||||||
|
//remove <>
|
||||||
|
p =s.indexOf('<');
|
||||||
|
if (p>=0)
|
||||||
|
s.truncate(p);
|
||||||
|
|
||||||
|
return statementMap.values(s);
|
||||||
|
}
|
||||||
|
|
||||||
PStatement CppParser::findStatementInScope(const QString &name, const QString &noNameArgs,
|
PStatement CppParser::findStatementInScope(const QString &name, const QString &noNameArgs,
|
||||||
StatementKind kind, const PStatement& scope)
|
StatementKind kind, const PStatement& scope)
|
||||||
{
|
{
|
||||||
|
|
|
@ -213,6 +213,8 @@ private:
|
||||||
PStatement findMemberOfStatement(
|
PStatement findMemberOfStatement(
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
const PStatement& scopeStatement);
|
const PStatement& scopeStatement);
|
||||||
|
QList<PStatement> findMembersOfStatement(const QString& phrase,
|
||||||
|
const PStatement& scopeStatement);
|
||||||
PStatement findStatementInScope(
|
PStatement findStatementInScope(
|
||||||
const QString& name,
|
const QString& name,
|
||||||
const QString& noNameArgs,
|
const QString& noNameArgs,
|
||||||
|
|
Loading…
Reference in New Issue