mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 379623 - Follow includes in inactive code paths
Change-Id: Iafc03eea7443b1d58a1521071783c39bbf3cdbcb
This commit is contained in:
parent
cf46cbf117
commit
4e7f132020
1 changed files with 16 additions and 1 deletions
|
@ -779,8 +779,23 @@ class OpenDeclarationsJob extends Job implements ASTRunnable {
|
||||||
if (incStmt.isResolved())
|
if (incStmt.isResolved())
|
||||||
name = incStmt.getPath();
|
name = incStmt.getPath();
|
||||||
|
|
||||||
|
IPath path = null;
|
||||||
if (name != 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);
|
openInclude(path);
|
||||||
} else {
|
} else {
|
||||||
fAction.reportIncludeLookupFailure(new String(incStmt.getName().toCharArray()));
|
fAction.reportIncludeLookupFailure(new String(incStmt.getName().toCharArray()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue