This is an archive of the discontinued LLVM Phabricator instance.

[Clang][Type] Add static assertion to guard future expansion for BuiltinType numbering
ClosedPublic

Authored by eopXD on Jun 8 2023, 1:39 AM.

Details

Summary

Recent expansion D152070 exceeds the limit and I had a hard time
triaging the bug because the overflow just creates unexpected
behaviors within the compiler.

This patch adds a static assertion to keep an eye for overflows when we
expand more types in the future.

Diff Detail

Event Timeline

eopXD created this revision.Jun 8 2023, 1:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 1:39 AM
eopXD requested review of this revision.Jun 8 2023, 1:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2023, 1:39 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
eopXD edited the summary of this revision. (Show Details)Jun 8 2023, 1:41 AM
aaron.ballman accepted this revision.Jun 8 2023, 8:34 AM

Thanks, this generally looks good but I did spot a small change to make (can make it when landing).

clang/include/clang/AST/Type.h
1542

I think this should move down to be directly above the definition of BuiltinTypeBitfields.

This revision is now accepted and ready to land.Jun 8 2023, 8:34 AM
eopXD updated this revision to Diff 529634.Jun 8 2023, 9:32 AM

Address comment from Aaron.

eopXD marked an inline comment as done.Jun 8 2023, 9:33 AM
This revision was landed with ongoing or failed builds.Jun 8 2023, 9:37 AM
This revision was automatically updated to reflect the committed changes.