Skip to content

Commit

Permalink
Add more info to assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaederr committed Oct 15, 2024
1 parent 113f583 commit ff72131
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions clang/lib/AST/ByteCode/Boolean.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class Boolean final {
Boolean truncate(unsigned TruncBits) const { return *this; }

static Boolean bitcastFromMemory(const std::byte *Buff, unsigned BitWidth) {
// Boolean width is currently always 8 for all supported targets. If this
// changes we need to get the bool width from the target info.
assert(BitWidth == 8);
bool Val = static_cast<bool>(*Buff);
return Boolean(Val);
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6417,7 +6417,7 @@ bool Compiler<Emitter>::emitBuiltinBitCast(const CastExpr *E) {
QualType ToType = E->getType();
std::optional<PrimType> ToT = classify(ToType);

assert(!DiscardResult && "Implement");
assert(!DiscardResult && "Implement DiscardResult mode for bitcasts.");

if (ToType->isNullPtrType()) {
if (!this->discard(SubExpr))
Expand All @@ -6440,7 +6440,7 @@ bool Compiler<Emitter>::emitBuiltinBitCast(const CastExpr *E) {

if (!ToT || ToT == PT_Ptr) {
// Conversion to an array or record type.
assert(false && "Implement");
assert(false && "Implement bitcast to pointers.");
}
assert(ToT);

Expand Down

0 comments on commit ff72131

Please sign in to comment.