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