Skip to content

[clang][bytecode][NFC] Fix a possible build warning #114800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

tbaederr
Copy link
Contributor

@tbaederr tbaederr commented Nov 4, 2024

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

InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not return a value in all control paths [-Wreturn-type]
   95 |   }
      |   ^
1 warning generated.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2024

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

Changes

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

@tbaederr tbaederr merged commit 3268d51 into llvm:main Nov 4, 2024
11 checks passed
PhilippRados pushed a commit to PhilippRados/llvm-project that referenced this pull request Nov 6, 2024
InterpBuiltinBitCast.cpp:95:3: warning: non-void function does not
return a value in all control paths [-Wreturn-type]
   95 |   }
      |   ^
1 warning generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants