Skip to content

[NFC] Reduce size of FunctionEffect to 1 byte. #100753

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 2 commits into from
Jul 26, 2024
Merged
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
11 changes: 5 additions & 6 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -4698,26 +4698,25 @@ class FunctionEffect {
};

private:
LLVM_PREFERRED_TYPE(Kind)
unsigned FKind : 3;
Kind FKind;

// Expansion: for hypothetical TCB+types, there could be one Kind for TCB,
// then ~16(?) bits "SubKind" to map to a specific named TCB. SubKind would
// be considered for uniqueness.

public:
FunctionEffect() : FKind(unsigned(Kind::None)) {}
FunctionEffect() : FKind(Kind::None) {}

explicit FunctionEffect(Kind K) : FKind(unsigned(K)) {}
explicit FunctionEffect(Kind K) : FKind(K) {}

/// The kind of the effect.
Kind kind() const { return Kind(FKind); }
Kind kind() const { return FKind; }

/// Return the opposite kind, for effects which have opposites.
Kind oppositeKind() const;

/// For serialization.
uint32_t toOpaqueInt32() const { return FKind; }
uint32_t toOpaqueInt32() const { return uint32_t(FKind); }
static FunctionEffect fromOpaqueInt32(uint32_t Value) {
return FunctionEffect(Kind(Value));
}
Expand Down
Loading