forked from qt-creator/qt-creator
Refactoring changes: Cleanup and improvements.
Previously RefactoringFiles were usually passed around by value. However, since a RefactoringFile may sometimes own a QTextDocument (when it was read from a file), that's not great and caused the file to be reread after every copy. With this change RefactoringFile becomes noncopyable and is always owned by a shared pointer. This change also allowed having const RefactoringFiles which is useful because they can be safely used from other threads. See CppRefactoringChanges::fileNoEditor. Change-Id: I9045921d6d0f6349f9558ff2a3d8317ea172193b Reviewed-on: http://codereview.qt.nokia.com/3084 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
@@ -287,7 +287,7 @@ InsertionLocation::InsertionLocation(const QString &fileName,
|
||||
, m_column(column)
|
||||
{}
|
||||
|
||||
InsertionPointLocator::InsertionPointLocator(CppRefactoringChanges *refactoringChanges)
|
||||
InsertionPointLocator::InsertionPointLocator(const CppRefactoringChanges &refactoringChanges)
|
||||
: m_refactoringChanges(refactoringChanges)
|
||||
{
|
||||
}
|
||||
@@ -297,7 +297,7 @@ InsertionLocation InsertionPointLocator::methodDeclarationInClass(
|
||||
const Class *clazz,
|
||||
AccessSpec xsSpec) const
|
||||
{
|
||||
const Document::Ptr doc = m_refactoringChanges->file(fileName).cppDocument();
|
||||
const Document::Ptr doc = m_refactoringChanges.file(fileName)->cppDocument();
|
||||
if (doc) {
|
||||
FindInClass find(doc, clazz, xsSpec);
|
||||
return find();
|
||||
@@ -434,11 +434,11 @@ QList<InsertionLocation> InsertionPointLocator::methodDefinition(
|
||||
target = candidate;
|
||||
}
|
||||
|
||||
Document::Ptr doc = m_refactoringChanges->file(target).cppDocument();
|
||||
Document::Ptr doc = m_refactoringChanges.file(target)->cppDocument();
|
||||
if (doc.isNull())
|
||||
return result;
|
||||
|
||||
Snapshot simplified = m_refactoringChanges->snapshot().simplified(doc);
|
||||
Snapshot simplified = m_refactoringChanges.snapshot().simplified(doc);
|
||||
if (Symbol *s = simplified.findMatchingDefinition(declaration)) {
|
||||
if (Function *f = s->asFunction()) {
|
||||
if (f->isConst() == declaration->type().isConst()
|
||||
|
||||
Reference in New Issue
Block a user