boga95 updated this revision to Diff 137915.
boga95 marked an inline comment as done.
boga95 added a comment.
Add capability to provide a user-configurable list of disallowed types which
will trigger warning. Now it also detects C srand function. Rename check to
cert-msc51-cpp. Add cert-msc32-c
Quuxplusone added inline comments.
Comment at: docs/clang-tidy/checks/cert-properly-seeded-random-generator.rst:26
+std::random_device dev;
+std::mt19937 engine3(dev()); // Good
+ }
Seeding MT19937 with a single 32-bit integer is //not// "Good". It makes
aaron.ballman added a comment.
Thank you for working on this check!
Do you think it might be possible to also add a check for `cert-msc32-c` that
handles the C side of things, and use a common check to implement both? C won't
ever have the C++'isms, but C++ can certainly abuse `std::srand()` so
boga95 created this revision.
boga95 added a reviewer: clang-tools-extra.
boga95 added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, mgorny.
This check flags all pseudo-random number engines and engine adaptors
instantiations when it initialized or seeded with default argum