Skip to content

Commit 221b8d9

Browse files
Make sure to call 'codegenMetadata()' on instances of 'FunctionType'
Signed-off-by: David Longnecker <[email protected]>
1 parent 34f061f commit 221b8d9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Diff for: compiler/codegen/codegen.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -1968,15 +1968,17 @@ static void codegen_header(std::set<const char*> & cnames,
19681968
if(!info->cfile) {
19691969
#ifdef HAVE_LLVM
19701970
// Codegen any type annotations that are necessary.
1971-
// Start with primitive types in case they are referenced by
1972-
// records or classes.
1973-
forv_Vec(TypeSymbol, typeSymbol, gTypeSymbols) {
1974-
if (typeSymbol->defPoint->parentExpr == rootModule->block &&
1975-
isPrimitiveType(typeSymbol->type) &&
1976-
typeSymbol->hasLLVMType()) {
1977-
typeSymbol->codegenMetadata();
1971+
// Start with primitive types and function types in case they are used
1972+
// by records or classes.
1973+
forv_Vec(TypeSymbol, ts, gTypeSymbols) {
1974+
bool isInRootModule = ts->defPoint->parentExpr == rootModule->block;
1975+
if (isInRootModule && ts->hasLLVMType()) {
1976+
if (isPrimitiveType(ts->type) || isFunctionType(ts->type)) {
1977+
ts->codegenMetadata();
1978+
}
19781979
}
19791980
}
1981+
19801982
forv_Vec(TypeSymbol, typeSymbol, types) {
19811983
if (!isDecoratedClassType(typeSymbol->type))
19821984
typeSymbol->codegenMetadata();

0 commit comments

Comments
 (0)