xref: /minix3/external/bsd/llvm/dist/clang/test/Analysis/cxx-method-names.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -analyze -analyzer-checker=core,unix,osx,alpha.unix,alpha.security.taint -analyzer-store region -verify %s
2*f4a2713aSLionel Sambuc // expected-no-diagnostics
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc class Evil {
5*f4a2713aSLionel Sambuc public:
6*f4a2713aSLionel Sambuc   void system(int); // taint checker
7*f4a2713aSLionel Sambuc   void malloc(void *); // taint checker, malloc checker
8*f4a2713aSLionel Sambuc   void free(); // malloc checker, keychain checker
9*f4a2713aSLionel Sambuc   void fopen(); // stream checker
10*f4a2713aSLionel Sambuc   void feof(int, int); // stream checker
11*f4a2713aSLionel Sambuc   void open(); // unix api checker
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc 
test(Evil & E)14*f4a2713aSLionel Sambuc void test(Evil &E) {
15*f4a2713aSLionel Sambuc   // no warnings, no crashes
16*f4a2713aSLionel Sambuc   E.system(0);
17*f4a2713aSLionel Sambuc   E.malloc(0);
18*f4a2713aSLionel Sambuc   E.free();
19*f4a2713aSLionel Sambuc   E.fopen();
20*f4a2713aSLionel Sambuc   E.feof(0,1);
21*f4a2713aSLionel Sambuc   E.open();
22*f4a2713aSLionel Sambuc }
23