[clang] 3268d51 - [clang][bytecode][NFC] Fix a possible build warning (#114800)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 07:58:47 PST 2024


Author: Timm Baeder
Date: 2024-11-04T16:58:44+01:00
New Revision: 3268d51a5c81be705a97216bf061fab9bb195ebe

URL: https://github.com/llvm/llvm-project/commit/3268d51a5c81be705a97216bf061fab9bb195ebe
DIFF: https://github.com/llvm/llvm-project/commit/3268d51a5c81be705a97216bf061fab9bb195ebe.diff

LOG: [clang][bytecode][NFC] Fix a possible build warning (#114800)

InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not
return a value in all control paths [-Wreturn-type]
   95 |   }
      |   ^
1 warning generated.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/InterpBuiltinBitCast.cpp

Removed: 
    


################################################################################
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