mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Bug 548902 - Fix exception in override methods refactoring
Change-Id: I2cde109ead8536c048bbe0a08083b36f924e4470 Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
This commit is contained in:
parent
5414def68f
commit
af88842969
1 changed files with 5 additions and 1 deletions
|
@ -106,6 +106,8 @@ public class DefinitionFinder {
|
||||||
IIndexFile indexFile = name.getFile();
|
IIndexFile indexFile = name.getFile();
|
||||||
if (contextTu.getASTFileSet().contains(indexFile) || contextTu.getIndexFileSet().contains(indexFile)) {
|
if (contextTu.getASTFileSet().contains(indexFile) || contextTu.getIndexFileSet().contains(indexFile)) {
|
||||||
ITranslationUnit tu = CoreModelUtil.findTranslationUnitForLocation(indexFile.getLocation(), null);
|
ITranslationUnit tu = CoreModelUtil.findTranslationUnitForLocation(indexFile.getLocation(), null);
|
||||||
|
if (tu == null)
|
||||||
|
return null;
|
||||||
if (searchedFiles.add(tu.getLocation().toOSString())) {
|
if (searchedFiles.add(tu.getLocation().toOSString())) {
|
||||||
findDefinitionsInTranslationUnit(indexBinding, tu, context, definitions, pm);
|
findDefinitionsInTranslationUnit(indexBinding, tu, context, definitions, pm);
|
||||||
if (definitions.size() > 1)
|
if (definitions.size() > 1)
|
||||||
|
@ -263,11 +265,13 @@ public class DefinitionFinder {
|
||||||
IASTName classDefintionName = getDefinition(classBinding, contextTu, context, pm);
|
IASTName classDefintionName = getDefinition(classBinding, contextTu, context, pm);
|
||||||
if (classDefintionName == null) {
|
if (classDefintionName == null) {
|
||||||
/*
|
/*
|
||||||
* We didn't find the class definition, check again the template definition then
|
* We didn't find the class definition, check again the template definition then if
|
||||||
* it was a template instance.
|
* it was a template instance.
|
||||||
*/
|
*/
|
||||||
if (classBinding instanceof ICPPTemplateInstance)
|
if (classBinding instanceof ICPPTemplateInstance)
|
||||||
classBinding = ((ICPPTemplateInstance) classBinding).getTemplateDefinition();
|
classBinding = ((ICPPTemplateInstance) classBinding).getTemplateDefinition();
|
||||||
|
else
|
||||||
|
return null;
|
||||||
classDefintionName = getDefinition(classBinding, contextTu, context, pm);
|
classDefintionName = getDefinition(classBinding, contextTu, context, pm);
|
||||||
if (classDefintionName == null)
|
if (classDefintionName == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue