/******************************************************************************
* Copyright (c) 2009 - 2015 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*****************************************************************************/
package com.ibm.wala.memsat.translation;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.util.warnings.Warning;
/**
* A warning generated by a Miniatur translator.
*
* @author Julian Dolby
* @author Emina Torlak
*/
public final class TranslationWarning extends Warning {
private final IR ir;
private final SSAInstruction inst;
private final String reason;
/**
* Constructs a new warning for the given ir, instruction and reason.
*/
TranslationWarning(IR ir, SSAInstruction inst, String reason) {
super(CLIENT_MODERATE);
this.ir = ir;
this.inst = inst;
this.reason = reason;
}
/**
* Constructs a new warning for the given ir and reason.
*/
TranslationWarning(String reason) {
this(null,null,reason);
}
/**
* {@inheritDoc}
* @see com.ibm.wala.util.warnings.Warning#getMsg()
*/
@Override
public String getMsg() {
if (inst == null) {
return "Incomplete model: " + reason;
} else {
return "Incomplete model of " +
inst.toString(ir.getSymbolTable()) +
" since " +
reason;
}
}
}