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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
|
@ -3380,6 +3402,16 @@ PStatement CppParser::findStatementInScope(const QString &name, const QString &n
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -44,25 +44,8 @@ public:
|
|||
QList<PStatement> getListOfFunctions(const QString& fileName,
|
||||
const QString& phrase,
|
||||
int line);
|
||||
PStatement 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 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;
|
||||
}
|
||||
PStatement findAndScanBlockAt(const QString& filename, int line);
|
||||
PFileIncludes findFileIncludes(const QString &filename, bool deleteIt = false);
|
||||
QString findFirstTemplateParamOf(const QString& fileName,
|
||||
const QString& phrase,
|
||||
const PStatement& currentScope);
|
||||
|
@ -237,15 +220,7 @@ private:
|
|||
const PStatement& scope);
|
||||
PStatement 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);
|
||||
}
|
||||
}
|
||||
const PStatement& scope);
|
||||
PStatement findStatementInNamespace(
|
||||
const QString& name,
|
||||
const QString& namespaceName);
|
||||
|
@ -255,7 +230,6 @@ private:
|
|||
const QString& phrase,
|
||||
const PStatement& startScope);
|
||||
|
||||
|
||||
/**
|
||||
* @brief evaluate the expression (starting from pos) in the scope
|
||||
* @param fileName
|
||||
|
|
|
@ -151,7 +151,6 @@ struct Statement {
|
|||
StatementClassScope classScope; // protected/private/public
|
||||
bool hasDefinition; // definiton line/filename is valid
|
||||
int line; // declaration
|
||||
int endLine;
|
||||
int definitionLine; // definition
|
||||
int definitionEndLine;
|
||||
QString fileName; // declaration
|
||||
|
@ -203,7 +202,6 @@ struct UsingNamespace {
|
|||
QStringList namespaces; // List['std','foo'] for using namespace std::foo;
|
||||
QString filename;
|
||||
int line;
|
||||
int endLine;
|
||||
bool fromHeader;
|
||||
};
|
||||
using PUsingNamespace = std::shared_ptr<UsingNamespace>;
|
||||
|
|
|
@ -104,7 +104,6 @@ void StatementModel::dumpAll(const QString &logFile)
|
|||
.arg((int)statement->classScope)
|
||||
.arg(statement->fileName)
|
||||
.arg(statement->line)
|
||||
.arg(statement->endLine)
|
||||
.arg(statement->definitionFileName)
|
||||
.arg(statement->definitionLine)
|
||||
.arg(statement->definitionEndLine)<<endl;
|
||||
|
@ -144,7 +143,6 @@ void StatementModel::dumpStatementMap(StatementMap &map, QTextStream &out, int l
|
|||
.arg((int)statement->classScope)
|
||||
.arg(statement->fileName)
|
||||
.arg(statement->line)
|
||||
.arg(statement->endLine)
|
||||
.arg(statement->definitionFileName)
|
||||
.arg(statement->definitionLine)
|
||||
.arg(statement->definitionEndLine)<<endl;
|
||||
|
|
Loading…
Reference in New Issue