@@ -2417,130 +2417,129 @@ class TranslatedConditionalExpr extends TranslatedNonConstantExpr,
24172417 }
24182418}
24192419
2420- /**
2421- * IR translation of a `throw` expression.
2422- */
2423- abstract class TranslatedThrowExpr extends TranslatedNonConstantExpr {
2424- override ThrowExpr expr ;
2425-
2426-
2427- override predicate hasInstruction ( Opcode opcode , InstructionTag tag ,
2428- Type resultType , boolean isLValue ) {
2429- tag = ThrowTag ( ) and
2430- opcode = getThrowOpcode ( ) and
2431- resultType instanceof VoidType and
2432- isLValue = false
2433- }
2434-
2435- override Instruction getInstructionSuccessor ( InstructionTag tag ,
2436- EdgeKind kind ) {
2437- tag = ThrowTag ( ) and
2438- kind instanceof ExceptionEdge and
2439- result = getParent ( ) .getExceptionSuccessorInstruction ( )
2440- }
2441-
2442- override Instruction getResult ( ) {
2443- none ( )
2444- }
2445-
2446- abstract Opcode getThrowOpcode ( ) ;
2447- }
2448-
2449- /**
2450- * IR translation of a `throw` expression with an argument
2451- * (e.g. `throw std::bad_alloc()`).
2452- */
2453- class TranslatedThrowValueExpr extends TranslatedThrowExpr ,
2454- InitializationContext {
2455- TranslatedThrowValueExpr ( ) {
2456- not expr instanceof ThrowExpr
2457- }
2458-
2459- override TranslatedElement getChild ( int id ) {
2460- id = 0 and result = getInitialization ( )
2461- }
2462-
2463- override Instruction getFirstInstruction ( ) {
2464- result = getInstruction ( InitializerVariableAddressTag ( ) )
2465- }
2466-
2467- override predicate hasInstruction ( Opcode opcode , InstructionTag tag ,
2468- Type resultType , boolean isLValue ) {
2469- TranslatedThrowExpr .super .hasInstruction ( opcode , tag , resultType , isLValue ) or
2470- tag = InitializerVariableAddressTag ( ) and
2471- opcode instanceof Opcode:: VariableAddress and
2472- resultType = getExceptionType ( ) and
2473- isLValue = true
2474- }
2475-
2476- override Instruction getInstructionSuccessor ( InstructionTag tag ,
2477- EdgeKind kind ) {
2478- result = TranslatedThrowExpr .super .getInstructionSuccessor ( tag , kind ) or
2479- (
2480- tag = InitializerVariableAddressTag ( ) and
2481- result = getInitialization ( ) .getFirstInstruction ( ) and
2482- kind instanceof GotoEdge
2483- )
2484- }
2485-
2486- override Instruction getChildSuccessor ( TranslatedElement child ) {
2487- child = getInitialization ( ) and
2488- result = getInstruction ( ThrowTag ( ) )
2489- }
2490-
2491- override IRVariable getInstructionVariable ( InstructionTag tag ) {
2492- tag = InitializerVariableAddressTag ( ) and
2493- result = getIRTempVariable ( expr , ThrowTempVar ( ) )
2494- }
2495-
2496- override final predicate hasTempVariable ( TempVariableTag tag , Type type ) {
2497- tag = ThrowTempVar ( ) and
2498- type = getExceptionType ( )
2499- }
2500-
2501- override final Instruction getInstructionOperand ( InstructionTag tag ,
2502- OperandTag operandTag ) {
2503- tag = ThrowTag ( ) and
2504- (
2505- (
2506- operandTag instanceof AddressOperandTag and
2507- result = getInstruction ( InitializerVariableAddressTag ( ) )
2508- ) or
2509- (
2510- operandTag instanceof LoadOperandTag and
2511- result = getEnclosingFunction ( ) .getUnmodeledDefinitionInstruction ( )
2512- )
2513- )
2514- }
2515-
2516- override final Type getInstructionOperandType ( InstructionTag tag ,
2517- TypedOperandTag operandTag ) {
2518- tag = ThrowTag ( ) and
2519- operandTag instanceof LoadOperandTag and
2520- result = getExceptionType ( )
2521- }
2522-
2523- override Instruction getTargetAddress ( ) {
2524- result = getInstruction ( InitializerVariableAddressTag ( ) )
2525- }
2526-
2527- override Type getTargetType ( ) {
2528- result = getExceptionType ( )
2529- }
2530-
2531- TranslatedInitialization getInitialization ( ) {
2532- result = getTranslatedInitialization (
2533- expr .getExpr ( ) )
2534- }
2535-
2536- override final Opcode getThrowOpcode ( ) {
2537- result instanceof Opcode:: ThrowValue
2538- }
2539-
2540- private Type getExceptionType ( ) {
2541- result = expr .getType ( )
2542- }
2543- }
2420+ ///**
2421+ // * IR translation of a `throw` expression.
2422+ // */
2423+ //abstract class TranslatedThrowExpr extends TranslatedNonConstantExpr {
2424+ // override ThrowExpr expr;
2425+ //
2426+ // override predicate hasInstruction(Opcode opcode, InstructionTag tag,
2427+ // Type resultType, boolean isLValue) {
2428+ // tag = ThrowTag() and
2429+ // opcode = getThrowOpcode() and
2430+ // resultType instanceof VoidType and
2431+ // isLValue = false
2432+ // }
2433+ //
2434+ // override Instruction getInstructionSuccessor(InstructionTag tag,
2435+ // EdgeKind kind) {
2436+ // tag = ThrowTag() and
2437+ // kind instanceof ExceptionEdge and
2438+ // result = getParent().getExceptionSuccessorInstruction()
2439+ // }
2440+ //
2441+ // override Instruction getResult() {
2442+ // none()
2443+ // }
2444+ //
2445+ // abstract Opcode getThrowOpcode();
2446+ //}
2447+ //
2448+ ///**
2449+ // * IR translation of a `throw` expression with an argument
2450+ // * (e.g. `throw std::bad_alloc()`).
2451+ // */
2452+ //class TranslatedThrowValueExpr extends TranslatedThrowExpr,
2453+ // InitializationContext {
2454+ // TranslatedThrowValueExpr() {
2455+ // not expr instanceof ThrowExpr
2456+ // }
2457+ //
2458+ // override TranslatedElement getChild(int id) {
2459+ // id = 0 and result = getInitialization()
2460+ // }
2461+ //
2462+ // override Instruction getFirstInstruction() {
2463+ // result = getInstruction(InitializerVariableAddressTag())
2464+ // }
2465+ //
2466+ // override predicate hasInstruction(Opcode opcode, InstructionTag tag,
2467+ // Type resultType, boolean isLValue) {
2468+ // TranslatedThrowExpr.super.hasInstruction(opcode, tag, resultType, isLValue) or
2469+ // tag = InitializerVariableAddressTag() and
2470+ // opcode instanceof Opcode::VariableAddress and
2471+ // resultType = getExceptionType() and
2472+ // isLValue = true
2473+ // }
2474+ //
2475+ // override Instruction getInstructionSuccessor(InstructionTag tag,
2476+ // EdgeKind kind) {
2477+ // result = TranslatedThrowExpr.super.getInstructionSuccessor(tag, kind) or
2478+ // (
2479+ // tag = InitializerVariableAddressTag() and
2480+ // result = getInitialization().getFirstInstruction() and
2481+ // kind instanceof GotoEdge
2482+ // )
2483+ // }
2484+ //
2485+ // override Instruction getChildSuccessor(TranslatedElement child) {
2486+ // child = getInitialization() and
2487+ // result = getInstruction(ThrowTag())
2488+ // }
2489+ //
2490+ // override IRVariable getInstructionVariable(InstructionTag tag) {
2491+ // tag = InitializerVariableAddressTag() and
2492+ // result = getIRTempVariable(expr, ThrowTempVar())
2493+ // }
2494+ //
2495+ // override final predicate hasTempVariable(TempVariableTag tag, Type type) {
2496+ // tag = ThrowTempVar() and
2497+ // type = getExceptionType()
2498+ // }
2499+ //
2500+ // override final Instruction getInstructionOperand(InstructionTag tag,
2501+ // OperandTag operandTag) {
2502+ // tag = ThrowTag() and
2503+ // (
2504+ // (
2505+ // operandTag instanceof AddressOperandTag and
2506+ // result = getInstruction(InitializerVariableAddressTag())
2507+ // ) or
2508+ // (
2509+ // operandTag instanceof LoadOperandTag and
2510+ // result = getEnclosingFunction().getUnmodeledDefinitionInstruction()
2511+ // )
2512+ // )
2513+ // }
2514+ //
2515+ // override final Type getInstructionOperandType(InstructionTag tag,
2516+ // TypedOperandTag operandTag) {
2517+ // tag = ThrowTag() and
2518+ // operandTag instanceof LoadOperandTag and
2519+ // result = getExceptionType()
2520+ // }
2521+ //
2522+ // override Instruction getTargetAddress() {
2523+ // result = getInstruction(InitializerVariableAddressTag())
2524+ // }
2525+ //
2526+ // override Type getTargetType() {
2527+ // result = getExceptionType()
2528+ // }
2529+ //
2530+ // TranslatedInitialization getInitialization() {
2531+ // result = getTranslatedInitialization(
2532+ // expr.getExpr())
2533+ // }
2534+ //
2535+ // override final Opcode getThrowOpcode() {
2536+ // result instanceof Opcode::ThrowValue
2537+ // }
2538+ //
2539+ // private Type getExceptionType() {
2540+ // result = expr.getType()
2541+ // }
2542+ //}
25442543
25452544// TODO: Should be handeled by the normal throw in C#
25462545///**
0 commit comments