1/* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef STATEMENT_H 6#define STATEMENT_H 7 8#include <Referenceable.h> 9 10#include "SourceLocation.h" 11#include "TargetAddressRange.h" 12#include "Types.h" 13 14 15class Statement : public BReferenceable { 16public: 17 virtual ~Statement(); 18 19 virtual SourceLocation StartSourceLocation() const = 0; 20 21 virtual TargetAddressRange CoveringAddressRange() const = 0; 22 23 virtual int32 CountAddressRanges() const = 0; 24 virtual TargetAddressRange AddressRangeAt(int32 index) const = 0; 25 26 virtual bool ContainsAddress(target_addr_t address) 27 const = 0; 28}; 29 30 31class AbstractStatement : public Statement { 32public: 33 AbstractStatement(const SourceLocation& start); 34 35 virtual SourceLocation StartSourceLocation() const; 36 37protected: 38 SourceLocation fStart; 39}; 40 41 42class ContiguousStatement : public AbstractStatement { 43public: 44 ContiguousStatement(const SourceLocation& start, 45 const TargetAddressRange& range); 46 47 const TargetAddressRange& AddressRange() const 48 { return fRange; } 49 50 virtual TargetAddressRange CoveringAddressRange() const; 51 52 virtual int32 CountAddressRanges() const; 53 virtual TargetAddressRange AddressRangeAt(int32 index) const; 54 55 virtual bool ContainsAddress(target_addr_t address) const; 56 57protected: 58 TargetAddressRange fRange; 59}; 60 61 62#endif // STATEMENT_H 63