[clang][Interp][NFCI] Don't crash on void builtin functions
authorTimm Bäder <tbaeder@redhat.com>
Sat, 7 Jan 2023 07:10:48 +0000 (08:10 +0100)
committerTimm Bäder <tbaeder@redhat.com>
Thu, 26 Jan 2023 06:32:33 +0000 (07:32 +0100)
classifyPrim() runs into a llvm_unreachable() for those.

clang/lib/AST/Interp/ByteCodeExprGen.cpp

index aaab980..316ba63 100644 (file)
@@ -1479,10 +1479,9 @@ bool ByteCodeExprGen<Emitter>::VisitBuiltinCallExpr(const CallExpr *E) {
   if (!this->emitCallBI(Func, E))
     return false;
 
-  if (DiscardResult) {
-    QualType ReturnType = E->getCallReturnType(Ctx.getASTContext());
+  QualType ReturnType = E->getCallReturnType(Ctx.getASTContext());
+  if (DiscardResult && !ReturnType->isVoidType()) {
     PrimType T = classifyPrim(ReturnType);
-
     return this->emitPop(T, E);
   }