Skip to content

[clang][bytecode] Classify 1-bit unsigned integers as bool #104662

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
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions clang/lib/AST/ByteCode/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ std::optional<PrimType> Context::classify(QualType T) const {
if (T->isAnyComplexType() || T->isVectorType())
return std::nullopt;

if (const auto *ET = T->getAs<EnumType>())
return classify(ET->getDecl()->getIntegerType());

if (T->isSignedIntegerOrEnumerationType()) {
switch (Ctx.getIntWidth(T)) {
case 64:
Expand All @@ -163,6 +160,9 @@ std::optional<PrimType> Context::classify(QualType T) const {
return PT_Uint16;
case 8:
return PT_Uint8;
case 1:
// Might happen for enum types.
return PT_Bool;
default:
return PT_IntAP;
}
Expand Down
3 changes: 2 additions & 1 deletion clang/test/AST/ByteCode/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,5 @@ void T1(void) {
// pedantic-warning {{use of GNU statement expression extension}}
}


enum teste1 test1f(void), (*test1)(void) = test1f; // pedantic-warning {{ISO C forbids forward references to 'enum' types}}
enum teste1 { TEST1 };
Loading