work save
This commit is contained in:
parent
e80a92c30a
commit
5fb877b2ef
|
@ -145,6 +145,28 @@ QList<PStatement> CppParser::getListOfFunctions(const QString &fileName, const Q
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PStatement CppParser::findAndScanBlockAt(const QString &filename, int line)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mMutex);
|
||||||
|
if (mParsing) {
|
||||||
|
return PStatement();
|
||||||
|
}
|
||||||
|
PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename);
|
||||||
|
if (!fileIncludes)
|
||||||
|
return PStatement();
|
||||||
|
|
||||||
|
PStatement statement = fileIncludes->scopes.findScopeAtLine(line);
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
|
||||||
|
PFileIncludes CppParser::findFileIncludes(const QString &filename, bool deleteIt)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mMutex);
|
||||||
|
PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename,PFileIncludes());
|
||||||
|
if (deleteIt && fileIncludes)
|
||||||
|
mPreprocessor.includesList().remove(filename);
|
||||||
|
return fileIncludes;
|
||||||
|
}
|
||||||
QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope)
|
QString CppParser::findFirstTemplateParamOf(const QString &fileName, const QString &phrase, const PStatement& currentScope)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
|
@ -3380,6 +3402,16 @@ PStatement CppParser::findStatementInScope(const QString &name, const QString &n
|
||||||
return PStatement();
|
return PStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PStatement CppParser::findStatementInScope(const QString &name, const PStatement &scope)
|
||||||
|
{
|
||||||
|
if (!scope)
|
||||||
|
return findMemberOfStatement(name,scope);
|
||||||
|
if (scope->kind == StatementKind::skNamespace) {
|
||||||
|
return findStatementInNamespace(name, scope->fullName);
|
||||||
|
} else {
|
||||||
|
return findMemberOfStatement(name,scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PStatement CppParser::findStatementInNamespace(const QString &name, const QString &namespaceName)
|
PStatement CppParser::findStatementInNamespace(const QString &name, const QString &namespaceName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,25 +44,8 @@ public:
|
||||||
QList<PStatement> getListOfFunctions(const QString& fileName,
|
QList<PStatement> getListOfFunctions(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
int line);
|
int line);
|
||||||
PStatement findAndScanBlockAt(const QString& filename, int line) {
|
PStatement findAndScanBlockAt(const QString& filename, int line);
|
||||||
QMutexLocker locker(&mMutex);
|
PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false);
|
||||||
if (mParsing) {
|
|
||||||
return PStatement();
|
|
||||||
}
|
|
||||||
PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename);
|
|
||||||
if (!fileIncludes)
|
|
||||||
return PStatement();
|
|
||||||
|
|
||||||
PStatement statement = fileIncludes->scopes.findScopeAtLine(line);
|
|
||||||
return statement;
|
|
||||||
}
|
|
||||||
PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false) {
|
|
||||||
QMutexLocker locker(&mMutex);
|
|
||||||
PFileIncludes fileIncludes = mPreprocessor.includesList().value(filename,PFileIncludes());
|
|
||||||
if (deleteIt && fileIncludes)
|
|
||||||
mPreprocessor.includesList().remove(filename);
|
|
||||||
return fileIncludes;
|
|
||||||
}
|
|
||||||
QString findFirstTemplateParamOf(const QString& fileName,
|
QString findFirstTemplateParamOf(const QString& fileName,
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
const PStatement& currentScope);
|
const PStatement& currentScope);
|
||||||
|
@ -237,15 +220,7 @@ private:
|
||||||
const PStatement& scope);
|
const PStatement& scope);
|
||||||
PStatement findStatementInScope(
|
PStatement findStatementInScope(
|
||||||
const QString& name,
|
const QString& name,
|
||||||
const PStatement& scope) {
|
const PStatement& scope);
|
||||||
if (!scope)
|
|
||||||
return findMemberOfStatement(name,scope);
|
|
||||||
if (scope->kind == StatementKind::skNamespace) {
|
|
||||||
return findStatementInNamespace(name, scope->fullName);
|
|
||||||
} else {
|
|
||||||
return findMemberOfStatement(name,scope);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PStatement findStatementInNamespace(
|
PStatement findStatementInNamespace(
|
||||||
const QString& name,
|
const QString& name,
|
||||||
const QString& namespaceName);
|
const QString& namespaceName);
|
||||||
|
@ -255,7 +230,6 @@ private:
|
||||||
const QString& phrase,
|
const QString& phrase,
|
||||||
const PStatement& startScope);
|
const PStatement& startScope);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief evaluate the expression (starting from pos) in the scope
|
* @brief evaluate the expression (starting from pos) in the scope
|
||||||
* @param fileName
|
* @param fileName
|
||||||
|
|
|
@ -151,7 +151,6 @@ struct Statement {
|
||||||
StatementClassScope classScope; // protected/private/public
|
StatementClassScope classScope; // protected/private/public
|
||||||
bool hasDefinition; // definiton line/filename is valid
|
bool hasDefinition; // definiton line/filename is valid
|
||||||
int line; // declaration
|
int line; // declaration
|
||||||
int endLine;
|
|
||||||
int definitionLine; // definition
|
int definitionLine; // definition
|
||||||
int definitionEndLine;
|
int definitionEndLine;
|
||||||
QString fileName; // declaration
|
QString fileName; // declaration
|
||||||
|
@ -203,7 +202,6 @@ struct UsingNamespace {
|
||||||
QStringList namespaces; // List['std','foo'] for using namespace std::foo;
|
QStringList namespaces; // List['std','foo'] for using namespace std::foo;
|
||||||
QString filename;
|
QString filename;
|
||||||
int line;
|
int line;
|
||||||
int endLine;
|
|
||||||
bool fromHeader;
|
bool fromHeader;
|
||||||
};
|
};
|
||||||
using PUsingNamespace = std::shared_ptr<UsingNamespace>;
|
using PUsingNamespace = std::shared_ptr<UsingNamespace>;
|
||||||
|
|
|
@ -104,7 +104,6 @@ void StatementModel::dumpAll(const QString &logFile)
|
||||||
.arg((int)statement->classScope)
|
.arg((int)statement->classScope)
|
||||||
.arg(statement->fileName)
|
.arg(statement->fileName)
|
||||||
.arg(statement->line)
|
.arg(statement->line)
|
||||||
.arg(statement->endLine)
|
|
||||||
.arg(statement->definitionFileName)
|
.arg(statement->definitionFileName)
|
||||||
.arg(statement->definitionLine)
|
.arg(statement->definitionLine)
|
||||||
.arg(statement->definitionEndLine)<<endl;
|
.arg(statement->definitionEndLine)<<endl;
|
||||||
|
@ -144,7 +143,6 @@ void StatementModel::dumpStatementMap(StatementMap &map, QTextStream &out, int l
|
||||||
.arg((int)statement->classScope)
|
.arg((int)statement->classScope)
|
||||||
.arg(statement->fileName)
|
.arg(statement->fileName)
|
||||||
.arg(statement->line)
|
.arg(statement->line)
|
||||||
.arg(statement->endLine)
|
|
||||||
.arg(statement->definitionFileName)
|
.arg(statement->definitionFileName)
|
||||||
.arg(statement->definitionLine)
|
.arg(statement->definitionLine)
|
||||||
.arg(statement->definitionEndLine)<<endl;
|
.arg(statement->definitionEndLine)<<endl;
|
||||||
|
|
Loading…
Reference in New Issue