From 34db07a83033a87fd5f041abf58b7aff422e352f Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Tue, 6 Apr 2004 18:12:55 +0000 Subject: [PATCH] small changes to help with template parsing --- core/org.eclipse.cdt.core/parser/ChangeLog-parser | 6 ++++++ .../parser/ast/complete/CompleteParseASTFactory.java | 9 ++++++--- .../cdt/internal/core/parser/pst/ParserSymbolTable.java | 4 +++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog-parser b/core/org.eclipse.cdt.core/parser/ChangeLog-parser index 4caa7d02bc9..3ac7d89fbd2 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog-parser +++ b/core/org.eclipse.cdt.core/parser/ChangeLog-parser @@ -1,3 +1,9 @@ +2004-04-06 Andrew Niefer + Small changes to help with template parsing + - report line numbers with some problems + - don't throw on SEMANTIC_INVALID_TYPE while doing templates + - handle some NPEs + 2004-04-06 Andrew Niefer fix bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=47625 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 62acbe62d22..56e82988cf3 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 @@ -715,10 +715,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } if( classSymbol != null && ! classSymbol.isForwardDeclaration() ) - handleProblem( IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED, newSymbolName ); + handleProblem( IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED, newSymbolName, nameOffset, nameEndOffset, nameLine ); if( classSymbol != null && classSymbol.getType() != pstType ) - handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, newSymbolName ); + handleProblem( IProblem.SEMANTIC_INVALID_OVERLOAD, newSymbolName, nameOffset, nameEndOffset, nameLine ); } IDerivableContainerSymbol newSymbol = pst.newDerivableContainerSymbol( newSymbolName, pstType ); @@ -803,7 +803,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto if( scope != null ){ IContainerSymbol symbol = scopeToSymbol( scope ); if( symbol.isTemplateMember() ){ - if( id == IProblem.SEMANTIC_INVALID_CONVERSION_TYPE ) + if( id == IProblem.SEMANTIC_INVALID_CONVERSION_TYPE || + id == IProblem.SEMANTIC_INVALID_TYPE ) { return false; } @@ -2237,6 +2238,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto Iterator p = parameters.iterator(); while (p.hasNext()){ ASTParameterDeclaration param = (ASTParameterDeclaration)p.next(); + if( param.getSymbol() == null ) + handleProblem( IProblem.SEMANTICS_RELATED, param.getName(), param.getNameOffset(), param.getEndingOffset(), param.getNameLineNumber() ); functionParameters.add(param.getSymbol().getTypeInfo()); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java index 614dc465601..0707204a38f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java @@ -638,6 +638,8 @@ public class ParserSymbolTable { { wrapper = (IDerivableContainerSymbol.IParentSymbol) iterator.next(); ISymbol parent = wrapper.getParent(); + if( parent == null ) + continue; if( !wrapper.isVirtual() || !data.visited.contains( parent ) ){ if( wrapper.isVirtual() ){ @@ -947,7 +949,7 @@ public class ParserSymbolTable { if( resolvedSymbol != null && resolvedSymbol.getTypeInfo().checkBit( TypeInfo.isTypedef ) ){ ISymbol symbol = resolvedSymbol.getTypeSymbol(); if( symbol == null ) - throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo ); + return resolvedSymbol; TypeInfo info = ParserSymbolTable.getFlatTypeInfo( symbol.getTypeInfo() );