brintos

brintos / llvm-project-archived public Read only

0
0
Text · 693 B · 8f00186 Raw
29 lines · cpp
1// RUN: %check_clang_tidy %s misc-predictable-rand %t2 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 [misc-predictable-rand]17 18  int j = ::rand();19  // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: rand() has limited randomness; use C++11 random library instead [misc-predictable-rand]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 [misc-predictable-rand]27}28 29