Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVladimir Hirsl2004-10-06 16:30:49 -0400
committerVladimir Hirsl2004-10-06 16:30:49 -0400
commitd0299598075dea7cd1b4d61c26527a668c5bbb7d (patch)
treed25128a380fa277df695e81472d6ed48cb70b86c /core
parent1f751745a975ab6747e9e2bc29504c4dff2d4056 (diff)
downloadorg.eclipse.cdt-d0299598075dea7cd1b4d61c26527a668c5bbb7d.tar.gz
org.eclipse.cdt-d0299598075dea7cd1b4d61c26527a668c5bbb7d.tar.xz
org.eclipse.cdt-d0299598075dea7cd1b4d61c26527a668c5bbb7d.zip
Fix for PR 75728 [ParserSymbolTable] NPE in TypeInfoProvider.newTypeInfo.
Corrected mappings added to to TemplateSymbol._defnParameterMap.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/ChangeLog12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java23
3 files changed, 34 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 3da8fc6931e..9fdbbf71878 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,15 @@
+2004-10-06 Vladimir Hirsl
+
+ Fix for PR 75728 [ParserSymbolTable] NPE in TypeInfoProvider.newTypeInfo
+ Corrected mappings added to to TemplateSymbol._defnParameterMap
+
+ * parser/org/eclipse/cdt/internal/core/parser/ast/TemplateFactory.java
+
+ Another NPE fix (caused by the fact that UndefinedTemplateSymbols do not have
+ any associated extension objects).
+
+ * parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
+
2004-09-30 Vladimir Hirsl
Fix for PR 60307 [Templates] Template parameter qualified types not supported
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
index 4d38dfda01d..45f6bc785ce 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
@@ -345,7 +345,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
}
else
{
- if( startingScope.getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope )
+ if( startingScope.getASTExtension() != null &&
+ startingScope.getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope )
{
if( ((IASTCodeScope) startingScope.getASTExtension().getPrimaryDeclaration()).getContainingFunction() instanceof IASTMethod )
{
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java
index 4b026f2c198..17da7a03409 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/TemplateFactory.java
@@ -278,17 +278,34 @@ public class TemplateFactory extends ExtensibleSymbol implements ITemplateFactor
int size = templates.size();
for( int i = 0; i < size; i++ ){
ITemplateSymbol template = (ITemplateSymbol) templates.get(i);
- ITemplateSymbol origTemplate = (ITemplateSymbol) ((ISymbol)symbols.get(i)).getContainingSymbol();
-
+ ISymbol origContainer = (ISymbol) symbols.get(i);
+ if ( origContainer instanceof IDeferredTemplateInstance )
+ origContainer = ((IDeferredTemplateInstance) origContainer).getTemplate().getTemplatedSymbol();
+ ITemplateSymbol origTemplate = (ITemplateSymbol)origContainer.getContainingSymbol();
+ ObjectMap containerDefnMap = null;
List tList = template.getParameterList();
+ if( origTemplate.getDefinitionParameterMap().containsKey( origContainer ) ){
+ containerDefnMap = (ObjectMap) origTemplate.getDefinitionParameterMap().get( origContainer );
+ }
List oList = origTemplate.getParameterList();
int tListSize = tList.size();
if( oList.size() < tListSize )
throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTemplate );
ObjectMap defnMap = new ObjectMap(tListSize);
- for( int j = 0; j < tListSize; j++ ){
+ for( int j = 0; j < tListSize; j++ ) {
ISymbol param = (ISymbol) tList.get(j);
ISymbol origParam = (ISymbol) oList.get(j);
+ if( containerDefnMap != null ) {
+ ISymbol keyParam, valParam;
+ for( int k = 0; k < containerDefnMap.size(); ++k ) {
+ keyParam = (ISymbol) containerDefnMap.keyAt( k );
+ valParam = (ISymbol) containerDefnMap.getAt( k );
+ if ( valParam.equals(origParam) ) {
+ origParam = keyParam;
+ break;
+ }
+ }
+ }
defnMap.put( param, origParam );
}

Back to the top