1// RUN: %check_clang_tidy %s cert-msc50-cpp %t
2
3int rand();
4int rand(int);
5
6namespace std {
7using ::rand;
8}
9
10namespace nonstd {
11 int rand();
12}
13
14void testFunction1() {
15 int i = std::rand();
16 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
17
18 int j = ::rand();
19 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
20
21 int k = rand(i);
22
23 int l = nonstd::rand();
24
25 int m = rand();
26 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [cert-msc50-cpp]
27}
28
29

source code of clang-tools-extra/test/clang-tidy/checkers/cert/limited-randomness.cpp