1*fce4895dSRene Gollent /* 2*fce4895dSRene Gollent * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3*fce4895dSRene Gollent * Distributed under the terms of the MIT License. 4*fce4895dSRene Gollent */ 5*fce4895dSRene Gollent 6*fce4895dSRene Gollent #include "Statement.h" 7*fce4895dSRene Gollent 8*fce4895dSRene Gollent 9*fce4895dSRene Gollent // #pragma mark - Statement 10*fce4895dSRene Gollent 11*fce4895dSRene Gollent ~Statement()12*fce4895dSRene GollentStatement::~Statement() 13*fce4895dSRene Gollent { 14*fce4895dSRene Gollent } 15*fce4895dSRene Gollent 16*fce4895dSRene Gollent 17*fce4895dSRene Gollent // #pragma mark - AbstractStatement 18*fce4895dSRene Gollent 19*fce4895dSRene Gollent AbstractStatement(const SourceLocation & start)20*fce4895dSRene GollentAbstractStatement::AbstractStatement(const SourceLocation& start) 21*fce4895dSRene Gollent : 22*fce4895dSRene Gollent fStart(start) 23*fce4895dSRene Gollent { 24*fce4895dSRene Gollent } 25*fce4895dSRene Gollent 26*fce4895dSRene Gollent 27*fce4895dSRene Gollent SourceLocation StartSourceLocation() const28*fce4895dSRene GollentAbstractStatement::StartSourceLocation() const 29*fce4895dSRene Gollent { 30*fce4895dSRene Gollent return fStart; 31*fce4895dSRene Gollent } 32*fce4895dSRene Gollent 33*fce4895dSRene Gollent 34*fce4895dSRene Gollent // #pragma mark - ContiguousStatement 35*fce4895dSRene Gollent 36*fce4895dSRene Gollent ContiguousStatement(const SourceLocation & start,const TargetAddressRange & range)37*fce4895dSRene GollentContiguousStatement::ContiguousStatement(const SourceLocation& start, 38*fce4895dSRene Gollent const TargetAddressRange& range) 39*fce4895dSRene Gollent : 40*fce4895dSRene Gollent AbstractStatement(start), 41*fce4895dSRene Gollent fRange(range) 42*fce4895dSRene Gollent { 43*fce4895dSRene Gollent } 44*fce4895dSRene Gollent 45*fce4895dSRene Gollent 46*fce4895dSRene Gollent TargetAddressRange CoveringAddressRange() const47*fce4895dSRene GollentContiguousStatement::CoveringAddressRange() const 48*fce4895dSRene Gollent { 49*fce4895dSRene Gollent return fRange; 50*fce4895dSRene Gollent } 51*fce4895dSRene Gollent 52*fce4895dSRene Gollent 53*fce4895dSRene Gollent int32 CountAddressRanges() const54*fce4895dSRene GollentContiguousStatement::CountAddressRanges() const 55*fce4895dSRene Gollent { 56*fce4895dSRene Gollent return 1; 57*fce4895dSRene Gollent } 58*fce4895dSRene Gollent 59*fce4895dSRene Gollent 60*fce4895dSRene Gollent TargetAddressRange AddressRangeAt(int32 index) const61*fce4895dSRene GollentContiguousStatement::AddressRangeAt(int32 index) const 62*fce4895dSRene Gollent { 63*fce4895dSRene Gollent return index == 0 ? fRange : TargetAddressRange(); 64*fce4895dSRene Gollent } 65*fce4895dSRene Gollent 66*fce4895dSRene Gollent 67*fce4895dSRene Gollent bool ContainsAddress(target_addr_t address) const68*fce4895dSRene GollentContiguousStatement::ContainsAddress(target_addr_t address) const 69*fce4895dSRene Gollent { 70*fce4895dSRene Gollent return fRange.Contains(address); 71*fce4895dSRene Gollent } 72