/** * Add constraints to represent the flow of exceptions to the exceptional return value for this node */ protected void addNodePassthruExceptionConstraints(CGNode node, IRView ir, DefUse du) { // add constraints relating to thrown exceptions that reach the exit block. List<ProgramCounter> peis = getIncomingPEIs(ir, ir.getExitBlock()); PointerKey exception = getPointerKeyForExceptionalReturnValue(node); TypeReference throwableType = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().getThrowableType(); IClass c = node.getClassHierarchy().lookupClass(throwableType); addExceptionDefConstraints(ir, du, node, peis, exception, Collections.singleton(c)); }
/** * Add constraints to represent the flow of exceptions to the exceptional return value for this node */ protected void addNodePassthruExceptionConstraints(CGNode node, IRView ir, DefUse du) { // add constraints relating to thrown exceptions that reach the exit block. List<ProgramCounter> peis = getIncomingPEIs(ir, ir.getExitBlock()); PointerKey exception = getPointerKeyForExceptionalReturnValue(node); TypeReference throwableType = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().getThrowableType(); IClass c = node.getClassHierarchy().lookupClass(throwableType); addExceptionDefConstraints(ir, du, node, peis, exception, Collections.singleton(c)); }
/** * Generate a set of constraints to represent assignment to an exception variable in a catch clause. Note that we use * FilterOperator to filter out types that the exception handler doesn't catch. * * @param exceptionVar points-to set for a variable representing a caught exception * @param catchClasses set of TypeReferences that the exceptionVar may catch * @param e points-to-set representing a thrown exception that might be caught. */ protected void addAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) { if (DEBUG_GENERAL) { System.err.println("addAssignmentsForCatch: " + catchClasses); } // this is tricky ... we want to filter based on a number of classes ... so we can't // just used a FilteredPointerKey for the exceptionVar. Instead, we create a new // "typed local" for each catch class, and coalesce the results using // assignment for (IClass c : catchClasses) { if (c.getReference().equals(c.getClassLoader().getLanguage().getThrowableType())) { system.newConstraint(exceptionVar, assignOperator, e); } else { FilteredPointerKey typedException = TypedPointerKey.make(exceptionVar, c); system.newConstraint(typedException, filterOperator, e); system.newConstraint(exceptionVar, assignOperator, typedException); } } }
/** * Generate a set of constraints to represent assignment to an exception variable in a catch clause. Note that we use * FilterOperator to filter out types that the exception handler doesn't catch. * * @param exceptionVar points-to set for a variable representing a caught exception * @param catchClasses set of TypeReferences that the exceptionVar may catch * @param e points-to-set representing a thrown exception that might be caught. */ protected void addAssignmentsForCatchPointerKey(PointerKey exceptionVar, Set<IClass> catchClasses, PointerKey e) { if (DEBUG_GENERAL) { System.err.println("addAssignmentsForCatch: " + catchClasses); } // this is tricky ... we want to filter based on a number of classes ... so we can't // just used a FilteredPointerKey for the exceptionVar. Instead, we create a new // "typed local" for each catch class, and coalesce the results using // assignment for (IClass c : catchClasses) { if (c.getReference().equals(c.getClassLoader().getLanguage().getThrowableType())) { system.newConstraint(exceptionVar, assignOperator, e); } else { FilteredPointerKey typedException = TypedPointerKey.make(exceptionVar, c); system.newConstraint(typedException, filterOperator, e); system.newConstraint(exceptionVar, assignOperator, typedException); } } }
Assertions.UNREACHABLE(); } catch (UnsupportedOperationException e) { x = new TypeReference[]{ language.getThrowableType() };
Assertions.UNREACHABLE(); } catch (UnsupportedOperationException e) { x = new TypeReference[]{ language.getThrowableType() };