[clang] [clang][bytecode][NFC] Reject invalid FromTypes in emitBuiltinBitcast (PR #118274)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 01:38:43 PST 2024


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/118274

instead of silently accepting them and failing later.

>From 989573d4b67760096a40edfae42f853a55f893fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 2 Dec 2024 10:36:58 +0100
Subject: [PATCH] [clang][bytecode][NFC] Reject invalid FromTypes in
 emitBuiltinBitcast

instead of silently accepting them and failing later.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index f4cc284dfb6abf..78e76ff01b0f3e 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -6514,6 +6514,8 @@ bool Compiler<Emitter>::emitBuiltinBitCast(const CastExpr *E) {
       return false;
     if (!this->emitGetPtrLocal(TempOffset, E))
       return false;
+  } else {
+    return false;
   }
 
   if (!ToT || ToT == PT_Ptr) {



More information about the cfe-commits mailing list