[PATCH] D129385: [lsan][Darwin] Scan libdispatch and Foundation memory regions
Julian Lettner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 11:49:47 PDT 2022
yln added inline comments.
================
Comment at: compiler-rt/lib/lsan/lsan_common_mac.cpp:36
+struct RegionScanState {
+ int seen_regions = static_cast<int>(SeenRegion::None);
+ bool in_libdispatch = false;
----------------
lgrey wrote:
> yln wrote:
> > Would making this a `SeenRegion` field get rid of the casts?
> Only if we implement `operator|` on it and do the casts in there. Given the number of uses it seems like a wash to me, happy to go with whichever you prefer.
Ahh, sorry I didn't realize this complication when suggesting using the `enum class`. TIL that enum classes and bitwise flags don't mesh well out of the box.
Since we are already halfway there, something like this should work, right?
```
inline AnimalFlags operator|(AnimalFlags a, AnimalFlags b)
{
return static_cast<AnimalFlags>(static_cast<int>(a) | static_cast<int>(b));
}
```
Thank you and apologies for the detour.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129385/new/
https://reviews.llvm.org/D129385
More information about the llvm-commits
mailing list