[clang] [clang][bytecode][NFC] Fix a possible build warning (PR #114800)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 06:15:53 PST 2024
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/114800
InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not return a value in all control paths [-Wreturn-type]
95 | }
| ^
1 warning generated.
>From 6dd415de97a46f77bb7999d4df9e3cb4bc942a86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Mon, 4 Nov 2024 15:14:43 +0100
Subject: [PATCH] [clang][bytecode][NFC] Fix a possible build warning
InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not return a value in all control paths [-Wreturn-type]
95 | }
| ^
1 warning generated.
---
clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
index e458613bc1d08d..27b20e258d94f4 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp
@@ -88,9 +88,8 @@ struct BitcastBuffer {
const std::byte *data() const { return Data.data(); }
std::byte *getBytes(unsigned BitOffset) const {
- if (BitOffset % 8 == 0)
- return const_cast<std::byte *>(data() + (BitOffset / 8));
- assert(false && "hmm, how to best handle this?");
+ assert(BitOffset % 8 == 0);
+ return const_cast<std::byte *>(data() + (BitOffset / 8));
}
bool allInitialized() const {
More information about the cfe-commits
mailing list