The checker detects various cases when an enum is probably misused (as a bitmask).
For the heuristics suggestions and improvement ideas are welcome.
Differential D22507
Clang-tidy - Enum misuse check szepet on Jul 19 2016, 4:25 AM. Authored by
Details The checker detects various cases when an enum is probably misused (as a bitmask). For the heuristics suggestions and improvement ideas are welcome.
Diff Detail Event TimelineComment Actions Please make sure the code align with LLVM code style (clang-format can help you to that).
Comment Actions Please mention this check in docs/ReleaseNotes.rst. See pre-4.0 branch versions as example.
Comment Actions drive-by, some comments.
Comment Actions Seems that you only uploaded the diff part, I only see the updated part of your patch now, and can't see the whole patch now (The review page says "Context not available"), could you upload the whole patch again?
Comment Actions some nits
Comment Actions Changes based on comments.
Comment Actions Changes based on comments, fix a cast to dyn_cast bug, description updated (hopefully it became more clear).
Comment Actions Close, but still a bunch of comments in the docs and a suggestion to fix a class of false positives.
Comment Actions In order to decrease false positive rate, the bitmask specific checker part investigate only the enumconstans which was initilized by a literal. (If this is too strong it can be modified) Renamed the checker to be more consistent with the checkers used for similar purpose. Documentation code examples updated. Comment Actions Thank you for the updates! Please re-run the check on LLVM to see what has changed.
Comment Actions Updates based on comments (the testfile note comments will be added in the next commit) Some changes in the algorithm/design: So strict mode results in this revision where we investigate only the literals:
Comment Actions LG with one nit. Feel free to ping earlier next time.
Comment Actions A few more notes, all fine for a follow up.
Comment Actions The requested changes have been made. |
These can be just static constants in the .cpp file. Apart from that, const char X[] = ...; is a better way to define string constants, otherwise you would have to go with const char * const X = ...; to make the pointer const as well.