Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2006-06-09 17:50:30 +0000
committerDoug Schaefer2006-06-09 17:50:30 +0000
commit52d99fabefb27c056cf8852b87930f52d26c022c (patch)
treecd1de2e6b7294090129220a93c7904486c4e1159
parent7279f74fd0f1fc7ad0e7c6a67530bf438b28f294 (diff)
downloadorg.eclipse.cdt-52d99fabefb27c056cf8852b87930f52d26c022c.tar.gz
org.eclipse.cdt-52d99fabefb27c056cf8852b87930f52d26c022c.tar.xz
org.eclipse.cdt-52d99fabefb27c056cf8852b87930f52d26c022c.zip
Bug 145245 - Added check in CPPASTTemplateId to detect that we're recursing and return null if we are. I also had to change CPPClassScope a little which wasn't expecting the null.
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateId.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java5
2 files changed, 9 insertions, 5 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateId.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateId.java
index 6be6f35ccd..5cee2cbb00 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateId.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplateId.java
@@ -65,13 +65,18 @@ public class CPPASTTemplateId extends CPPASTNode implements ICPPASTTemplateId, I
private IASTNode [] templateArguments = null;
private IBinding binding = null;
+ private boolean resolving = false;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTName#resolveBinding()
*/
public IBinding resolveBinding() {
- if( binding == null )
- binding = CPPTemplates.createBinding( this );
+ if (binding == null && !resolving) {
+ // protect for infinite recursion
+ resolving = true;
+ binding = CPPTemplates.createBinding( this );
+ resolving = false;
+ }
return binding;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
index 54eddf1aa5..f5b40b5c25 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPClassScope.java
@@ -255,9 +255,8 @@ public class CPPClassScope extends CPPScope implements ICPPClassScope {
Object obj = set.keyAt( i );
if( obj instanceof IASTName ){
IASTName n = (IASTName) obj;
- binding = n.getBinding();
- if( binding != null || forceResolve ){
- binding = n.resolveBinding();
+ binding = forceResolve ? n.resolveBinding() : n.getBinding();
+ if( binding != null ) {
set.remove( n );
set.put( binding );
i--;

Back to the top