1//===- AssertCmd.h --------------------------------------------------------===// 2// 3// The MCLinker Project 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9#ifndef MCLD_SCRIPT_ASSERTCMD_H 10#define MCLD_SCRIPT_ASSERTCMD_H 11 12#include <mcld/Script/ScriptCommand.h> 13#include <string> 14 15namespace mcld 16{ 17 18class RpnExpr; 19class Module; 20 21/** \class AssertCmd 22 * \brief This class defines the interfaces to assert command. 23 */ 24 25class AssertCmd : public ScriptCommand 26{ 27public: 28 AssertCmd(RpnExpr& pRpnExpr, const std::string& pMessage); 29 30 ~AssertCmd(); 31 32 AssertCmd& operator=(const AssertCmd& pAssertCmd); 33 34 const RpnExpr& getRpnExpr() const { return m_RpnExpr; } 35 RpnExpr& getRpnExpr() { return m_RpnExpr; } 36 37 const std::string& message() const { return m_Message; } 38 39 void dump() const; 40 41 static bool classof(const ScriptCommand* pCmd) 42 { 43 return pCmd->getKind() == ScriptCommand::ASSERT; 44 } 45 46 void activate(Module& pModule); 47 48private: 49 RpnExpr& m_RpnExpr; 50 std::string m_Message; 51}; 52 53} // namespace of mcld 54 55#endif 56