1 //===- AssertCmd.cpp ------------------------------------------------------===// 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 #include "mcld/Script/AssertCmd.h" 10 11 #include "mcld/LinkerScript.h" 12 #include "mcld/Module.h" 13 #include "mcld/Script/RpnExpr.h" 14 #include "mcld/Support/raw_ostream.h" 15 16 namespace mcld { 17 18 //===----------------------------------------------------------------------===// 19 // AssertCmd 20 //===----------------------------------------------------------------------===// AssertCmd(RpnExpr & pRpnExpr,const std::string & pMessage)21AssertCmd::AssertCmd(RpnExpr& pRpnExpr, const std::string& pMessage) 22 : ScriptCommand(ScriptCommand::ASSERT), 23 m_RpnExpr(pRpnExpr), 24 m_Message(pMessage) { 25 } 26 ~AssertCmd()27AssertCmd::~AssertCmd() { 28 } 29 operator =(const AssertCmd & pAssertCmd)30AssertCmd& AssertCmd::operator=(const AssertCmd& pAssertCmd) { 31 return *this; 32 } 33 dump() const34void AssertCmd::dump() const { 35 mcld::outs() << "Assert ( "; 36 37 m_RpnExpr.dump(); 38 39 mcld::outs() << " , " << m_Message << " )\n"; 40 } 41 activate(Module & pModule)42void AssertCmd::activate(Module& pModule) { 43 pModule.getScript().assertions().push_back(*this); 44 } 45 46 } // namespace mcld 47