mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-12 05:47:11 +03:00
Add missing getDefaultValue() to frontend C++ interface
This commit is contained in:
parent
8b2fa980e9
commit
81cdec0f7a
3 changed files with 14 additions and 1 deletions
|
@ -14,6 +14,7 @@ import dmd.aggregate : AggregateDeclaration;
|
|||
import dmd.arraytypes;
|
||||
import dmd.astenums;
|
||||
import dmd.common.outbuffer : OutBuffer;
|
||||
import dmd.denum : EnumDeclaration;
|
||||
import dmd.dmodule /*: Module*/;
|
||||
import dmd.dscope : Scope;
|
||||
import dmd.dstruct /*: StructDeclaration*/;
|
||||
|
@ -213,6 +214,15 @@ void genCppHdrFiles(ref Modules ms)
|
|||
return dmd.dtoh.genCppHdrFiles(ms);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* enumsem.d
|
||||
*/
|
||||
Expression getDefaultValue(EnumDeclaration ed, const ref Loc loc)
|
||||
{
|
||||
import dmd.enumsem;
|
||||
return dmd.enumsem.getDefaultValue(ed, loc);
|
||||
}
|
||||
|
||||
/***********************************************************
|
||||
* expression.d
|
||||
*/
|
||||
|
|
|
@ -40,6 +40,7 @@ class OverloadSet;
|
|||
class StringExp;
|
||||
class InterpExp;
|
||||
class LoweredAssignExp;
|
||||
class EnumDeclaration;
|
||||
#ifdef IN_GCC
|
||||
typedef union tree_node Symbol;
|
||||
#elif IN_LLVM
|
||||
|
@ -54,6 +55,8 @@ namespace dmd
|
|||
Expression *expressionSemantic(Expression *e, Scope *sc);
|
||||
// in typesem.d
|
||||
Expression *defaultInit(Type *mt, const Loc &loc, const bool isCfile = false);
|
||||
// in enumsem.d
|
||||
Expression *getDefaultValue(EnumDeclaration *ed, const Loc &loc);
|
||||
|
||||
// Entry point for CTFE.
|
||||
// A compile-time result is required. Give an error if not possible
|
||||
|
|
|
@ -153,7 +153,7 @@ public:
|
|||
}
|
||||
// otherwise emit a void[] with the default initializer
|
||||
else {
|
||||
Expression *defaultval = sd->getDefaultValue(decl->loc);
|
||||
Expression *defaultval = getDefaultValue(sd, decl->loc);
|
||||
LLConstant *c = toConstElem(defaultval, gIR);
|
||||
b.push_void_array(c, sd->memtype, sd);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue