1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Bug 379623 - Follow includes in inactive code paths

Change-Id: Iafc03eea7443b1d58a1521071783c39bbf3cdbcb
This commit is contained in:
Nathan Ridge 2016-12-06 03:08:34 -05:00
parent cf46cbf117
commit 4e7f132020

View file

@ -779,8 +779,23 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
if (incStmt.isResolved())
name = incStmt.getPath();
IPath path = null;
if (name != null) {
final IPath path = new Path(name);
path = new Path(name);
} else if (!incStmt.isActive()) {
// Includes inside inactive preprocessor branches will not be resolved in the AST.
// For these, attempt resolving the include via the C model as a fallback.
try {
ICElement element = SelectionConverter.getElementAtOffset(fTranslationUnit, fTextSelection);
if (element instanceof IInclude) {
path = CElementIncludeResolver.resolveInclude((IInclude) element);
}
} catch (CModelException e) {
} catch (CoreException e) {
}
}
if (path != null) {
openInclude(path);
} else {
fAction.reportIncludeLookupFailure(new String(incStmt.getName().toCharArray()));