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 //===----------------------------------------------------------------------===// 20 AssertCmd::AssertCmd(RpnExpr& pRpnExpr, const std::string& pMessage) 21 : ScriptCommand(ScriptCommand::ASSERT), 22 m_RpnExpr(pRpnExpr), 23 m_Message(pMessage) 24 { 25 } 26 27 AssertCmd::~AssertCmd() 28 { 29 } 30 31 AssertCmd& AssertCmd::operator=(const AssertCmd& pAssertCmd) 32 { 33 return *this; 34 } 35 36 void AssertCmd::dump() const 37 { 38 mcld::outs() << "Assert ( "; 39 40 m_RpnExpr.dump(); 41 42 mcld::outs() << " , " << m_Message << " )\n"; 43 } 44 45 void AssertCmd::activate(Module& pModule) 46 { 47 pModule.getScript().assertions().push_back(*this); 48 } 49