mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
There was a NPE in CompleteParseASTFactory.createElaboratedTypeSpecifier in the case
where it was not a forward declaration and the symbol was not found during lookup. report a IProblem.SEMANTIC_NAME_NOT_FOUND instead of NPE
This commit is contained in:
parent
7b78e2923e
commit
3846748090
2 changed files with 18 additions and 11 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-03-12 Andrew Niefer
|
||||
handle case causing NPE in CompleteParseASTFactory.createElaboratedTypeSpecifier
|
||||
|
||||
2004-03-12 Andrew Niefer
|
||||
bug 54639 fix NPE in CompleteParseASTFactory.cloneSimpleTypeSymbol
|
||||
|
||||
|
|
|
@ -2583,17 +2583,21 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
}
|
||||
}
|
||||
|
||||
if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTClassSpecifier ||
|
||||
checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTEnumerationSpecifier
|
||||
)
|
||||
{
|
||||
ASTElaboratedTypeSpecifier elab = new ASTElaboratedTypeSpecifier( checkSymbol, kind, startingOffset, startingLine, name.getFirstToken().getOffset(), name.getLastToken().getEndOffset(), name.getLastToken().getLineNumber(), endOffset, endingLine, references, isForewardDecl );
|
||||
attachSymbolExtension( checkSymbol, elab, isForewardDecl );
|
||||
return elab;
|
||||
}
|
||||
if( checkSymbol != null ){
|
||||
if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTClassSpecifier ||
|
||||
checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTEnumerationSpecifier
|
||||
)
|
||||
{
|
||||
ASTElaboratedTypeSpecifier elab = new ASTElaboratedTypeSpecifier( checkSymbol, kind, startingOffset, startingLine, name.getFirstToken().getOffset(), name.getLastToken().getEndOffset(), name.getLastToken().getLineNumber(), endOffset, endingLine, references, isForewardDecl );
|
||||
attachSymbolExtension( checkSymbol, elab, isForewardDecl );
|
||||
return elab;
|
||||
}
|
||||
|
||||
if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTElaboratedTypeSpecifier )
|
||||
return (IASTElaboratedTypeSpecifier)checkSymbol.getASTExtension().getPrimaryDeclaration();
|
||||
if( checkSymbol.getASTExtension().getPrimaryDeclaration() instanceof IASTElaboratedTypeSpecifier )
|
||||
return (IASTElaboratedTypeSpecifier)checkSymbol.getASTExtension().getPrimaryDeclaration();
|
||||
} else {
|
||||
handleProblem(IProblem.SEMANTIC_NAME_NOT_FOUND, lastToken.getImage(), lastToken.getOffset(), lastToken.getEndOffset(), lastToken.getLineNumber() );
|
||||
}
|
||||
|
||||
|
||||
// assert false : this;
|
||||
|
|
Loading…
Add table
Reference in a new issue