C++: Improve file accuracy when finding symbols

This patch introduces a priority-based mechanism when searching for certains
symbols in the snapshot. The priority corresponds to how similar the file path
from the "reference" symbol is to the file path from the "candidate" symbol.
This solves a variety of issues when matching "equivalent" symbols but that
are in another file/project, such as when following a function declaration,
a forward class declaration, or adding a definition through a quickfix.

There's now a symbol finder which will compute the "best" search order and cache
the most recent results. A consequence is that following symbols in some cases
is slower, but not apparently significatly.

Note: The "find" functions were moved from the Snapshot to the new SymbolFinder
class.

Task-number: QTCREATORBUG-6697
Task-number: QTCREATORBUG-6792

Change-Id: Ia518f014275fec1f4d0cb3224bd4e06a9df6d557
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
This commit is contained in:
Leandro Melo
2012-01-20 14:43:21 +01:00
parent 271ec63a10
commit 466ea4842c
12 changed files with 451 additions and 269 deletions

View File

@@ -37,7 +37,8 @@ HEADERS += completionsettingspage.h \
cppcodestylepreferences.h \
cpptoolsreuse.h \
doxygengenerator.h \
commentssettings.h
commentssettings.h \
symbolfinder.h
SOURCES += completionsettingspage.cpp \
cppclassesfilter.cpp \
@@ -66,7 +67,8 @@ SOURCES += completionsettingspage.cpp \
cppcodestylepreferences.cpp \
cpptoolsreuse.cpp \
doxygengenerator.cpp \
commentssettings.cpp
commentssettings.cpp \
symbolfinder.cpp
FORMS += completionsettingspage.ui \
cppfilesettingspage.ui \