No functional change.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| include/clang/Basic/Sanitizers.h | ||
|---|---|---|
| 28 ↗ | (On Diff #25363) | Leave this named as SanitizerOrdinal, so that SO_ prefix makes sense. |
| 49 ↗ | (On Diff #25363) | Fix comments to reflect that we're checking/setting sets of sanitizers now. However, I think we might still use two different entities for SanitizerKind and SanitizerMask.... |
| 62 ↗ | (On Diff #25363) | Any reason to make this public? |
| lib/CodeGen/CGExpr.cpp | ||
| 2246 ↗ | (On Diff #25363) | That's the problem I see with using SanitizerMask instead of SanitizerKind class enum - sometimes (like in this case) we want to distinguish between a *single* sanitizer kind and a set of sanitizers. Here, for example, what should we return if Kind contains both Vptr and Return? Add a method that would tell you if SanitizerMask contains a single kind, and assert in this function? |
| 2304 ↗ | (On Diff #25363) | Same here - what if SanitizeRecover is defined for some bits in Checked[i].second, and not defined for another? |
- Address review comments
| include/clang/Basic/Sanitizers.h | ||
|---|---|---|
| 28 ↗ | (On Diff #25363) | Done. |
| 49 ↗ | (On Diff #25363) |
These functions are for single sanitizers only. I've added assertion checks to enforce that.
I don't think we need to do that. In my opinion it just makes things more confusing. |
| 62 ↗ | (On Diff #25363) | It makes the code simpler, as we don't need accessor functions in every case where we need to do some bit operation on the mask. |
| lib/CodeGen/CGExpr.cpp | ||
| 2246 ↗ | (On Diff #25363) |
Yes. It makes more sense to add dynamic checks to the rare function that accepts a single sanitizer, than to use two different enums and try to make sure that the right one is being used everywhere. |
| 2304 ↗ | (On Diff #25363) | Added an assertion check to SanitizerSet::has. |
Thanks for doing this! Feel free to apply after addressing comments below.
| lib/CodeGen/CGExpr.cpp | ||
|---|---|---|
| 3391 ↗ | (On Diff #25372) | Looks like you don't need this cast (you don't have them in other places). |
| lib/Driver/SanitizerArgs.cpp | ||
| 113 ↗ | (On Diff #25372) | Please add parens: (Sanitizers.Mask & NeedsUbsanRt) |
| 120 ↗ | (On Diff #25372) | ditto |
| 147 ↗ | (On Diff #25372) | Consider using SanitizerMask type for local variables where appropriate |
| 444 ↗ | (On Diff #25372) | clang-format this patch |