[clang] [clang][bytecode][NFC] Fix a possible build warning (PR #114800)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 06:16:28 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not return a value in all control paths [-Wreturn-type]
95 | }
| ^
1 warning generated.
---
Full diff: https://github.com/llvm/llvm-project/pull/114800.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp (+2-3)
``````````diff
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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/114800
More information about the cfe-commits
mailing list