[r302]: cmajor++ / Cm / Cm.Core / Callable.hpp  Maximize  Restore  History

Download this file

48 lines (37 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*========================================================================
Copyright (c) 2012-2013 Seppo Laakko
http://sourceforge.net/projects/cmajor/
Distributed under the GNU General Public License, version 3 (GPLv3).
(See accompanying LICENSE.txt or http://www.gnu.org/licenses/gpl.html)
========================================================================*/
#ifndef CM_CORE_CALLABLE_INCLUDED
#define CM_CORE_CALLABLE_INCLUDED
#include <Cm.Core/Type.hpp>
#include <Llvm.Ir/Parameter.hpp>
namespace Cm { namespace Core {
class Callable
{
public:
virtual ~Callable();
virtual TypePtr GetReturnType() const = 0;
virtual const ParameterList& GetParameters() const = 0;
virtual bool CanThrow() const = 0;
virtual void CreateIntermediateRepresentations();
bool ReturnsClassObjectByValue() const { return GetReturnType() && GetReturnType()->IsClassType(); }
Llvm::Ir::TypePtr GetIrReturnType() const { return irReturnType; }
const std::vector<Llvm::Ir::ParameterPtr>& GetIrParams() const { return irParameters; }
const std::vector<Llvm::Ir::TypePtr> GetIrParamTypes() const { return irParameterTypes; }
Llvm::Ir::ParameterPtr GetIrClassObjectParam() const { return irClassObjectPtrParam; }
private:
Llvm::Ir::TypePtr irReturnType;
Llvm::Ir::ParameterPtr irClassObjectPtrParam;
std::vector<Llvm::Ir::ParameterPtr> irParameters;
std::vector<Llvm::Ir::TypePtr> irParameterTypes;
};
class CallableType: public Callable, public Type
{
public:
CallableType(const std::string& name_, const Position& pos_, const ScopePtr& enclosingScope_, const ScopePtr& fileScope_, int id_, int rank_);
};
} } // namespace Cm::Core
#endif // CM_CORE_CALLABLE_INCLUDED