Skip to content

Commit 289c3e3

Browse files
PappasBrentxlauko
authored andcommitted
cg: Check getFunctionType() result is not empty.
- Check if getFunctionType() is not an empty type.
1 parent 740d067 commit 289c3e3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/vast/CodeGen/CodeGenStmtVisitor.hpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,14 @@ namespace vast::cg {
978978
operation VisitIndirectCall(const clang::CallExpr *expr) {
979979
auto callee = VisitIndirectCallee(expr->getCallee())->getResult(0);
980980
auto args = VisitArguments(expr);
981-
auto type = hl::getFunctionType(callee.getType(), context().mod.get()).getResults();
982-
return make< hl::IndirectCallOp >(meta_location(expr), type, callee, args);
981+
auto type = hl::getFunctionType(callee.getType(), context().mod.get());
982+
if (type) {
983+
return make< hl::IndirectCallOp >(
984+
meta_location(expr), type.getResults(), callee, args
985+
);
986+
}
987+
988+
return {};
983989
}
984990

985991
operation VisitCallExpr(const clang::CallExpr *expr) {

0 commit comments

Comments
 (0)