From 66a27d2fc7c1ad4e97de76d4982168a0fed9920a Mon Sep 17 00:00:00 2001 From: Patrick Schönberger Date: Thu, 12 Aug 2021 10:32:51 +0200 Subject: comments --- src/generic.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/generic.h') diff --git a/src/generic.h b/src/generic.h index df203b3..33323e4 100644 --- a/src/generic.h +++ b/src/generic.h @@ -4,6 +4,7 @@ #include "typeInfo.h" #include "visit.h" +// add a generic instantiation if its not in the vector already void addGenericInstantiation( std::vector> & insts, const std::vector & newInst) @@ -32,6 +33,8 @@ Program instantiateGenerics(const Program & p) // Find generic instantiations + // visit expressions (only function calls are considered) and types, + // find the function/struct by pointer and add an instantiation Visitor findGenericInstantiations; findGenericInstantiations.onExpr = [&](const Expr & e, const std::shared_ptr ctx) @@ -48,7 +51,6 @@ Program instantiateGenerics(const Program & p) addGenericInstantiation(std::get<0>(*f)->genericInstantiations, e._func.genericInstantiation); } } - // TODO: generic methods }; findGenericInstantiations.onType = [&](const Type & t, const std::shared_ptr ctx) @@ -72,6 +74,10 @@ Program instantiateGenerics(const Program & p) return result; } +// generate the appendix for C struct/function names +// including array/pointer indicators because +// there might be distinct instantiations +// for int and int* for example std::string genericAppendix(const std::vector & ts) { std::stringstream sstr; -- cgit v1.2.3