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