From af73a4ed1a684ac9f16e8edca297bda0afb13e1d Mon Sep 17 00:00:00 2001 From: Nathan Ridge Date: Thu, 22 Feb 2018 00:10:07 -0500 Subject: [PATCH] Bug 531475 - Push a lookup point when precomputing variable types and initial values in PDOMWriter.resolveNames() Change-Id: Ia9d0c51a963f70d9a8b0ffcd3fa6b6c508f1d1dc --- .../cdt/internal/core/pdom/PDOMWriter.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java index a0ff9786c04..c27413fd19c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java @@ -428,9 +428,19 @@ public abstract class PDOMWriter implements IPDOMASTProcessor { // to the index. for (ICPPInternalDeclaredVariable variable : variables) { if (isVariableIndexed(variable)) { - // Type and initial value will be cached by the variable. - variable.getType(); - variable.getInitialValue(); + IASTNode lookupPoint = variable.getDefinition() != null + ? variable.getDefinition() + : (variable.getDeclarations() != null && variable.getDeclarations().length > 0) + ? variable.getDeclarations()[0] + : data.fAST; + CPPSemantics.pushLookupPoint(lookupPoint); + try { + // Type and initial value will be cached by the variable. + variable.getType(); + variable.getInitialValue(); + } finally { + CPPSemantics.popLookupPoint(); + } } }