diff options
author | Sergey Prigogin | 2014-04-01 17:17:59 +0000 |
---|---|---|
committer | Sergey Prigogin | 2014-04-01 17:33:37 +0000 |
commit | 5850c018933f9b7627472d5385b52f233c25f901 (patch) | |
tree | b124d78fb947b0b026a162ba22f8109754f4828f /core | |
parent | 8c3ba9ec2d651d0f1faa0dfd2266365030e34918 (diff) | |
download | org.eclipse.cdt-5850c018933f9b7627472d5385b52f233c25f901.tar.gz org.eclipse.cdt-5850c018933f9b7627472d5385b52f233c25f901.tar.xz org.eclipse.cdt-5850c018933f9b7627472d5385b52f233c25f901.zip |
Bug 431596 - NPE in BindingCollector.leave.
Diffstat (limited to 'core')
-rw-r--r-- | core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java index 901c763c953..9079ae2e8db 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java @@ -972,34 +972,37 @@ public class BindingClassifier { * } */ IASTUnaryExpression unaryExpression = (IASTUnaryExpression) expression; - if (unaryExpression instanceof ICPPASTUnaryExpression) { - ICPPFunction overload = ((ICPPASTUnaryExpression) unaryExpression).getOverload(); - if (overload != null) { - defineFunction(overload, new IASTInitializerClause[] { unaryExpression.getOperand() }); - return PROCESS_CONTINUE; + IASTExpression operand = unaryExpression.getOperand(); + if (operand != null) { // A throw expression may have no operand. + if (unaryExpression instanceof ICPPASTUnaryExpression) { + ICPPFunction overload = ((ICPPASTUnaryExpression) unaryExpression).getOverload(); + if (overload != null) { + defineFunction(overload, new IASTInitializerClause[] { operand }); + return PROCESS_CONTINUE; + } } - } - boolean expressionDefinitionRequired = true; - switch (unaryExpression.getOperator()) { - case IASTUnaryExpression.op_amper: - case IASTUnaryExpression.op_bracketedPrimary: - // The ampersand operator as well as brackets never require a definition. - expressionDefinitionRequired = false; - break; - case IASTUnaryExpression.op_alignOf: - case IASTUnaryExpression.op_not: - case IASTUnaryExpression.op_plus: - case IASTUnaryExpression.op_sizeof: - case IASTUnaryExpression.op_typeid: - // If the operand is a pointer type, then it doesn't need to be defined. - if (unaryExpression.getOperand().getExpressionType() instanceof IPointerType) { + boolean expressionDefinitionRequired = true; + switch (unaryExpression.getOperator()) { + case IASTUnaryExpression.op_amper: + case IASTUnaryExpression.op_bracketedPrimary: + // The ampersand operator as well as brackets never require a definition. expressionDefinitionRequired = false; - } - } - - if (expressionDefinitionRequired) { - defineTypeExceptTypedefOrNonFixedEnum(unaryExpression.getOperand().getExpressionType()); + break; + case IASTUnaryExpression.op_alignOf: + case IASTUnaryExpression.op_not: + case IASTUnaryExpression.op_plus: + case IASTUnaryExpression.op_sizeof: + case IASTUnaryExpression.op_typeid: + // If the operand is a pointer type, then it doesn't need to be defined. + if (operand.getExpressionType() instanceof IPointerType) { + expressionDefinitionRequired = false; + } + } + + if (expressionDefinitionRequired) { + defineTypeExceptTypedefOrNonFixedEnum(operand.getExpressionType()); + } } } else if (expression instanceof IASTBinaryExpression) { /* |