Daniel Dunbar | 8b57697 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Argyrios Kyrtzidis | 9eb02df | 2011-02-28 19:49:42 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t %s |
NAKAMURA Takumi | bf37ee7 | 2014-11-04 13:05:10 +0000 | [diff] [blame] | 3 | // RUN: find %t -name "*.html" -exec cat "{}" ";" | FileCheck %s |
Daniel Dunbar | aef52f4 | 2009-11-05 02:11:37 +0000 | [diff] [blame] | 4 | |
NAKAMURA Takumi | 1fb02cb | 2014-07-16 12:05:45 +0000 | [diff] [blame] | 5 | // REQUIRES: staticanalyzer |
| 6 | |
Daniel Dunbar | aef52f4 | 2009-11-05 02:11:37 +0000 | [diff] [blame] | 7 | // CHECK: <h3>Annotated Source Code</h3> |
Andrew Trick | 9642cc6 | 2010-10-21 03:59:06 +0000 | [diff] [blame] | 8 | |
| 9 | // Without tweaking expr, the expr would hit to the line below |
| 10 | // emitted to the output as comment. |
| 11 | // CHECK: {{[D]ereference of null pointer}} |
Daniel Dunbar | 23bd6cc | 2008-10-04 20:46:41 +0000 | [diff] [blame] | 12 | |
| 13 | void f0(int x) { |
| 14 | int *p = &x; |
| 15 | |
| 16 | if (x > 10) { |
| 17 | if (x == 22) |
| 18 | p = 0; |
| 19 | } |
| 20 | |
| 21 | *p = 10; |
| 22 | } |
| 23 | |
| 24 | |