forked from qt-creator/qt-creator
CppTools: Use class member prefix "m_" in builtincursorinfo.cpp
Change-Id: I8e4079734f9167dcc9da2ceff027f8559bab367f Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -106,9 +106,9 @@ CursorInfo::Ranges toRanges(const QList<int> tokenIndices, TranslationUnit *tran
|
|||||||
|
|
||||||
class FunctionDefinitionUnderCursor: protected ASTVisitor
|
class FunctionDefinitionUnderCursor: protected ASTVisitor
|
||||||
{
|
{
|
||||||
unsigned _line = 0;
|
unsigned m_line = 0;
|
||||||
unsigned _column = 0;
|
unsigned m_column = 0;
|
||||||
DeclarationAST *_functionDefinition = nullptr;
|
DeclarationAST *m_functionDefinition = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FunctionDefinitionUnderCursor(TranslationUnit *translationUnit)
|
FunctionDefinitionUnderCursor(TranslationUnit *translationUnit)
|
||||||
@@ -117,17 +117,17 @@ public:
|
|||||||
|
|
||||||
DeclarationAST *operator()(AST *ast, unsigned line, unsigned column)
|
DeclarationAST *operator()(AST *ast, unsigned line, unsigned column)
|
||||||
{
|
{
|
||||||
_functionDefinition = nullptr;
|
m_functionDefinition = nullptr;
|
||||||
_line = line;
|
m_line = line;
|
||||||
_column = column;
|
m_column = column;
|
||||||
accept(ast);
|
accept(ast);
|
||||||
return _functionDefinition;
|
return m_functionDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool preVisit(AST *ast)
|
virtual bool preVisit(AST *ast)
|
||||||
{
|
{
|
||||||
if (_functionDefinition)
|
if (m_functionDefinition)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (FunctionDefinitionAST *def = ast->asFunctionDefinition())
|
if (FunctionDefinitionAST *def = ast->asFunctionDefinition())
|
||||||
@@ -149,9 +149,9 @@ private:
|
|||||||
getTokenStartPosition(ast->firstToken(), &startLine, &startColumn);
|
getTokenStartPosition(ast->firstToken(), &startLine, &startColumn);
|
||||||
getTokenEndPosition(ast->lastToken() - 1, &endLine, &endColumn);
|
getTokenEndPosition(ast->lastToken() - 1, &endLine, &endColumn);
|
||||||
|
|
||||||
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
if (m_line > startLine || (m_line == startLine && m_column >= startColumn)) {
|
||||||
if (_line < endLine || (_line == endLine && _column < endColumn)) {
|
if (m_line < endLine || (m_line == endLine && m_column < endColumn)) {
|
||||||
_functionDefinition = ast;
|
m_functionDefinition = ast;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,12 +173,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FindUses(const QTextCursor &textCursor, const Document::Ptr document, const Snapshot &snapshot)
|
FindUses(const QTextCursor &textCursor, const Document::Ptr document, const Snapshot &snapshot)
|
||||||
: document(document), snapshot(snapshot)
|
: m_document(document), m_snapshot(snapshot)
|
||||||
{
|
{
|
||||||
TextEditor::Convenience::convertPosition(textCursor.document(), textCursor.position(),
|
TextEditor::Convenience::convertPosition(textCursor.document(), textCursor.position(),
|
||||||
&line, &column);
|
&m_line, &m_column);
|
||||||
CanonicalSymbol canonicalSymbol(document, snapshot);
|
CanonicalSymbol canonicalSymbol(document, snapshot);
|
||||||
scope = canonicalSymbol.getScopeAndExpression(textCursor, &expression);
|
m_scope = canonicalSymbol.getScopeAndExpression(textCursor, &m_expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorInfo doFind() const
|
CursorInfo doFind() const
|
||||||
@@ -201,12 +201,12 @@ private:
|
|||||||
|
|
||||||
CppTools::SemanticInfo::LocalUseMap findLocalUses() const
|
CppTools::SemanticInfo::LocalUseMap findLocalUses() const
|
||||||
{
|
{
|
||||||
AST *ast = document->translationUnit()->ast();
|
AST *ast = m_document->translationUnit()->ast();
|
||||||
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(document->translationUnit());
|
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(m_document->translationUnit());
|
||||||
DeclarationAST *declaration = functionDefinitionUnderCursor(ast,
|
DeclarationAST *declaration = functionDefinitionUnderCursor(ast,
|
||||||
static_cast<unsigned>(line),
|
static_cast<unsigned>(m_line),
|
||||||
static_cast<unsigned>(column));
|
static_cast<unsigned>(m_column));
|
||||||
return CppTools::LocalSymbols(document, declaration).uses;
|
return CppTools::LocalSymbols(m_document, declaration).uses;
|
||||||
}
|
}
|
||||||
|
|
||||||
void splitLocalUses(const CppTools::SemanticInfo::LocalUseMap &uses,
|
void splitLocalUses(const CppTools::SemanticInfo::LocalUseMap &uses,
|
||||||
@@ -216,7 +216,7 @@ private:
|
|||||||
QTC_ASSERT(rangesForLocalVariableUnderCursor, return);
|
QTC_ASSERT(rangesForLocalVariableUnderCursor, return);
|
||||||
QTC_ASSERT(rangesForLocalUnusedVariables, return);
|
QTC_ASSERT(rangesForLocalUnusedVariables, return);
|
||||||
|
|
||||||
LookupContext context(document, snapshot);
|
LookupContext context(m_document, m_snapshot);
|
||||||
|
|
||||||
CppTools::SemanticInfo::LocalUseIterator it(uses);
|
CppTools::SemanticInfo::LocalUseIterator it(uses);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
@@ -225,9 +225,9 @@ private:
|
|||||||
|
|
||||||
bool good = false;
|
bool good = false;
|
||||||
foreach (const CppTools::SemanticInfo::Use &use, uses) {
|
foreach (const CppTools::SemanticInfo::Use &use, uses) {
|
||||||
unsigned l = static_cast<unsigned>(line);
|
unsigned l = static_cast<unsigned>(m_line);
|
||||||
// convertCursorPosition() returns a 0-based column number.
|
// convertCursorPosition() returns a 0-based column number.
|
||||||
unsigned c = static_cast<unsigned>(column + 1);
|
unsigned c = static_cast<unsigned>(m_column + 1);
|
||||||
if (l == use.line && c >= use.column && c <= (use.column + use.length)) {
|
if (l == use.line && c >= use.column && c <= (use.column + use.length)) {
|
||||||
good = true;
|
good = true;
|
||||||
break;
|
break;
|
||||||
@@ -246,19 +246,19 @@ private:
|
|||||||
CursorInfo::Ranges findReferences() const
|
CursorInfo::Ranges findReferences() const
|
||||||
{
|
{
|
||||||
CursorInfo::Ranges result;
|
CursorInfo::Ranges result;
|
||||||
if (!scope || expression.isEmpty())
|
if (!m_scope || m_expression.isEmpty())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
TypeOfExpression typeOfExpression;
|
TypeOfExpression typeOfExpression;
|
||||||
Snapshot theSnapshot = snapshot;
|
Snapshot theSnapshot = m_snapshot;
|
||||||
theSnapshot.insert(document);
|
theSnapshot.insert(m_document);
|
||||||
typeOfExpression.init(document, theSnapshot);
|
typeOfExpression.init(m_document, theSnapshot);
|
||||||
typeOfExpression.setExpandTemplates(true);
|
typeOfExpression.setExpandTemplates(true);
|
||||||
|
|
||||||
if (Symbol *s = CanonicalSymbol::canonicalSymbol(scope, expression, typeOfExpression)) {
|
if (Symbol *s = CanonicalSymbol::canonicalSymbol(m_scope, m_expression, typeOfExpression)) {
|
||||||
CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance();
|
CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance();
|
||||||
const QList<int> tokenIndices = mmi->references(s, typeOfExpression.context());
|
const QList<int> tokenIndices = mmi->references(s, typeOfExpression.context());
|
||||||
result = toRanges(tokenIndices, document->translationUnit());
|
result = toRanges(tokenIndices, m_document->translationUnit());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -266,16 +266,16 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Shared
|
// Shared
|
||||||
Document::Ptr document;
|
Document::Ptr m_document;
|
||||||
|
|
||||||
// For local use calculation
|
// For local use calculation
|
||||||
int line;
|
int m_line;
|
||||||
int column;
|
int m_column;
|
||||||
|
|
||||||
// For references calculation
|
// For references calculation
|
||||||
Scope *scope;
|
Scope *m_scope;
|
||||||
QString expression;
|
QString m_expression;
|
||||||
Snapshot snapshot;
|
Snapshot m_snapshot;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isSemanticInfoValidExceptLocalUses(const SemanticInfo &semanticInfo, int revision)
|
bool isSemanticInfoValidExceptLocalUses(const SemanticInfo &semanticInfo, int revision)
|
||||||
|
|||||||
Reference in New Issue
Block a user