[clang] nonblocking/nonallocating attributes: 2nd pass caller/callee analysis (PR #99656)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 23 18:07:06 PDT 2024
================
@@ -4940,6 +4955,78 @@ class FunctionEffectsRef {
void dump(llvm::raw_ostream &OS) const;
};
+/// A mutable set of FunctionEffect::Kind.
+class FunctionEffectKindSet {
+ // For now this only needs to be a bitmap.
+ constexpr static size_t EndBitPos = 8;
+ using KindBitsT = std::bitset<EndBitPos>;
+
+ KindBitsT KindBits{};
+
+ explicit FunctionEffectKindSet(KindBitsT KB) : KindBits(KB) {}
+
+ constexpr static size_t kindToPos(FunctionEffect::Kind K) {
+ return static_cast<size_t>(K);
+ }
+
+public:
+ FunctionEffectKindSet() = default;
+ explicit FunctionEffectKindSet(FunctionEffectsRef FX) { insert(FX); }
+
+ // Iterates through the bits which are set.
+ class iterator {
----------------
Sirraide wrote:
As I understand it, you can still return values of inaccessible type just fine from functions. You just can’t *name* `iterator` outside of this class, so `auto x = set.begin()` works, but `FunctionEffectKindSet::iterator x = set.begin()` doesn’t, and since range-based `for` loops are specified to use `auto`/`auto&&`, everything works fine.
https://github.com/llvm/llvm-project/pull/99656
More information about the cfe-commits
mailing list