1
2
3
4
5
6 #ifndef CMAJOR_BINDER_CLASS_TEMPLATE_REPOSITORY_INCLUDED
7 #define CMAJOR_BINDER_CLASS_TEMPLATE_REPOSITORY_INCLUDED
8 #include <cmajor/binder/BinderApi.hpp>
9 #include <cmajor/symbols/ClassTemplateSpecializationSymbol.hpp>
10
11 namespace cmajor { namespace binder {
12
13 using namespace cmajor::symbols;
14
15 class BoundCompileUnit;
16 class BoundFunction;
17
18 struct ClassIdMemberFunctionIndexHash
19 {
20 size_t operator()(const std::std::pair<boost::uuids::uuid, int>&p) const;
21 };
22
23 class ClassTemplateRepository
24 {
25 public:
26 ClassTemplateRepository(BoundCompileUnit& boundCompileUnit_);
27 void ResolveDefaultTemplateArguments(std::std::vector<TypeSymbol*>&templateArgumentTypes, ClassTypeSymbol*classTemplate, ContainerScope*containerScope,
28 const Span& span, const boost::uuids::uuid& moduleId);
29 void BindClassTemplateSpecialization(ClassTemplateSpecializationSymbol* classTemplateSpecialization, ContainerScope* containerScope, const Span& span, const boost::uuids::uuid& moduleId);
30 bool Instantiate(FunctionSymbol* memberFunction, ContainerScope* containerScope, BoundFunction* currentFunction, const Span& span, const boost::uuids::uuid& moduleId);
31 private:
32 BoundCompileUnit& boundCompileUnit;
33 std::unordered_set<FunctionSymbol*> instantiatedMemberFunctions;
34 std::unordered_set<std::std::pair<boost::uuids::uuid, int>, ClassIdMemberFunctionIndexHash>classIdMemberFunctionIndexSet;
35 bool InstantiateDestructorAndVirtualFunctions(ClassTemplateSpecializationSymbol* classTemplateSpecialization, ContainerScope* containerScope, BoundFunction* currentFunction,
36 const Span& span, const boost::uuids::uuid& moduleId);
37 };
38
39 } }
40
41 #endif // CMAJOR_BINDER_CLASS_TEMPLATE_REPOSITORY_INCLUDED