Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / diagnostics / Inputs / expected-sarif / sarif-multi-diagnostic-test.c.sarif
blobae49ad6604cb2a538f108ed1a400a4fcc3995971
2   "$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json",
3   "runs": [
4     {
5       "artifacts": [
6         {
7           "length": 1081,
8           "location": {
9             "index": 0,
10           },
11           "mimeType": "text/plain",
12           "roles": [
13             "resultFile"
14           ]
15         }
16       ],
17       "columnKind": "unicodeCodePoints",
18       "results": [
19         {
20           "codeFlows": [
21             {
22               "threadFlows": [
23                 {
24                   "locations": [
25                     {
26                       "importance": "essential",
27                       "location": {
28                         "message": {
29                           "text": "Calling 'f'"
30                         },
31                         "physicalLocation": {
32                           "artifactLocation": {
33                             "index": 0,
34                           },
35                           "region": {
36                             "endColumn": 6,
37                             "endLine": 39,
38                             "startColumn": 3,
39                             "startLine": 39
40                           }
41                         }
42                       }
43                     },
44                     {
45                       "importance": "essential",
46                       "location": {
47                         "message": {
48                           "text": "tainted"
49                         },
50                         "physicalLocation": {
51                           "artifactLocation": {
52                             "index": 0,
53                           },
54                           "region": {
55                             "endColumn": 18,
56                             "endLine": 11,
57                             "startColumn": 11,
58                             "startLine": 11
59                           }
60                         }
61                       }
62                     }
63                   ]
64                 }
65               ]
66             }
67           ],
68           "level": "warning",
69           "locations": [
70             {
71               "physicalLocation": {
72                 "artifactLocation": {
73                   "index": 0,
74                 },
75                 "region": {
76                   "endColumn": 18,
77                   "endLine": 11,
78                   "startColumn": 11,
79                   "startLine": 11
80                 }
81               }
82             }
83           ],
84           "message": {
85             "text": "tainted"
86           },
87           "ruleId": "debug.TaintTest",
88           "ruleIndex": 0
89         },
90         {
91           "codeFlows": [
92             {
93               "threadFlows": [
94                 {
95                   "locations": [
96                     {
97                       "importance": "essential",
98                       "location": {
99                         "message": {
100                           "text": "Calling 'g'"
101                         },
102                         "physicalLocation": {
103                           "artifactLocation": {
104                             "index": 0,
105                           },
106                           "region": {
107                             "endColumn": 6,
108                             "endLine": 40,
109                             "startColumn": 3,
110                             "startLine": 40
111                           }
112                         }
113                       }
114                     },
115                     {
116                       "importance": "essential",
117                       "location": {
118                         "message": {
119                           "text": "'fp' declared without an initial value"
120                         },
121                         "physicalLocation": {
122                           "artifactLocation": {
123                             "index": 0,
124                           },
125                           "region": {
126                             "endColumn": 12,
127                             "endLine": 15,
128                             "startColumn": 3,
129                             "startLine": 15
130                           }
131                         }
132                       }
133                     },
134                     {
135                       "importance": "essential",
136                       "location": {
137                         "message": {
138                           "text": "Called function pointer is an uninitialized pointer value"
139                         },
140                         "physicalLocation": {
141                           "artifactLocation": {
142                             "index": 0,
143                           },
144                           "region": {
145                             "endColumn": 9,
146                             "endLine": 16,
147                             "startColumn": 3,
148                             "startLine": 16
149                           }
150                         }
151                       }
152                     }
153                   ]
154                 }
155               ]
156             }
157           ],
158           "level": "warning",
159           "locations": [
160             {
161               "physicalLocation": {
162                 "artifactLocation": {
163                   "index": 0,
164                 },
165                 "region": {
166                   "endColumn": 9,
167                   "endLine": 16,
168                   "startColumn": 3,
169                   "startLine": 16
170                 }
171               }
172             }
173           ],
174           "message": {
175             "text": "Called function pointer is an uninitialized pointer value"
176           },
177           "ruleId": "core.CallAndMessage",
178           "ruleIndex": 1
179         },
180         {
181           "codeFlows": [
182             {
183               "threadFlows": [
184                 {
185                   "locations": [
186                     {
187                       "importance": "important",
188                       "location": {
189                         "message": {
190                           "text": "Assuming 'i' is equal to 0"
191                         },
192                         "physicalLocation": {
193                           "artifactLocation": {
194                             "index": 0,
195                           },
196                           "region": {
197                             "endColumn": 13,
198                             "endLine": 20,
199                             "startColumn": 7,
200                             "startLine": 20
201                           }
202                         }
203                       }
204                     },
205                     {
206                       "importance": "unimportant",
207                       "location": {
208                         "message": {
209                           "text": "Taking true branch"
210                         },
211                         "physicalLocation": {
212                           "artifactLocation": {
213                             "index": 0,
214                           },
215                           "region": {
216                             "endColumn": 3,
217                             "startColumn": 3,
218                             "startLine": 20
219                           }
220                         }
221                       }
222                     },
223                     {
224                       "importance": "essential",
225                       "location": {
226                         "message": {
227                           "text": "Division by zero"
228                         },
229                         "physicalLocation": {
230                           "artifactLocation": {
231                             "index": 0,
232                           },
233                           "region": {
234                             "endColumn": 14,
235                             "startColumn": 14,
236                             "startLine": 21
237                           }
238                         }
239                       }
240                     }
241                   ]
242                 }
243               ]
244             }
245           ],
246           "level": "warning",
247           "locations": [
248             {
249               "physicalLocation": {
250                 "artifactLocation": {
251                   "index": 0,
252                 },
253                 "region": {
254                   "endColumn": 14,
255                   "startColumn": 14,
256                   "startLine": 21
257                 }
258               }
259             }
260           ],
261           "message": {
262             "text": "Division by zero"
263           },
264           "ruleId": "core.DivideZero",
265           "ruleIndex": 2
266         },
267         {
268           "codeFlows": [
269             {
270               "threadFlows": [
271                 {
272                   "locations": [
273                     {
274                       "importance": "essential",
275                       "location": {
276                         "message": {
277                           "text": "Memory is allocated"
278                         },
279                         "physicalLocation": {
280                           "artifactLocation": {
281                             "index": 0,
282                           },
283                           "region": {
284                             "endColumn": 24,
285                             "endLine": 26,
286                             "startColumn": 15,
287                             "startLine": 26
288                           }
289                         }
290                       }
291                     },
292                     {
293                       "importance": "important",
294                       "location": {
295                         "message": {
296                           "text": "Assuming 'i' is < 4"
297                         },
298                         "physicalLocation": {
299                           "artifactLocation": {
300                             "index": 0,
301                           },
302                           "region": {
303                             "endColumn": 12,
304                             "endLine": 27,
305                             "startColumn": 7,
306                             "startLine": 27
307                           }
308                         }
309                       }
310                     },
311                     {
312                       "importance": "unimportant",
313                       "location": {
314                         "message": {
315                           "text": "Taking true branch"
316                         },
317                         "physicalLocation": {
318                           "artifactLocation": {
319                             "index": 0,
320                           },
321                           "region": {
322                             "endColumn": 3,
323                             "startColumn": 3,
324                             "startLine": 27
325                           }
326                         }
327                       }
328                     },
329                     {
330                       "importance": "essential",
331                       "location": {
332                         "message": {
333                           "text": "Potential leak of memory pointed to by 'mem'"
334                         },
335                         "physicalLocation": {
336                           "artifactLocation": {
337                             "index": 0,
338                           },
339                           "region": {
340                             "endColumn": 12,
341                             "startColumn": 12,
342                             "startLine": 28
343                           }
344                         }
345                       }
346                     }
347                   ]
348                 }
349               ]
350             }
351           ],
352           "level": "warning",
353           "locations": [
354             {
355               "physicalLocation": {
356                 "artifactLocation": {
357                   "index": 0,
358                 },
359                 "region": {
360                   "endColumn": 12,
361                   "startColumn": 12,
362                   "startLine": 28
363                 }
364               }
365             }
366           ],
367           "message": {
368             "text": "Potential leak of memory pointed to by 'mem'"
369           },
370           "ruleId": "unix.Malloc",
371           "ruleIndex": 3
372         },
373         {
374           "codeFlows": [
375             {
376               "threadFlows": [
377                 {
378                   "locations": [
379                     {
380                       "importance": "essential",
381                       "location": {
382                         "message": {
383                           "text": "'løçål' initialized to 0"
384                         },
385                         "physicalLocation": {
386                           "artifactLocation": {
387                             "index": 0,
388                           },
389                           "region": {
390                             "endColumn": 12,
391                             "endLine": 34,
392                             "startColumn": 3,
393                             "startLine": 34
394                           }
395                         }
396                       }
397                     },
398                     {
399                       "importance": "essential",
400                       "location": {
401                         "message": {
402                           "text": "Division by zero"
403                         },
404                         "physicalLocation": {
405                           "artifactLocation": {
406                             "index": 0,
407                           },
408                           "region": {
409                             "endColumn": 20,
410                             "startColumn": 20,
411                             "startLine": 35
412                           }
413                         }
414                       }
415                     }
416                   ]
417                 }
418               ]
419             }
420           ],
421           "level": "warning",
422           "locations": [
423             {
424               "physicalLocation": {
425                 "artifactLocation": {
426                   "index": 0,
427                 },
428                 "region": {
429                   "endColumn": 20,
430                   "startColumn": 20,
431                   "startLine": 35
432                 }
433               }
434             }
435           ],
436           "message": {
437             "text": "Division by zero"
438           },
439           "ruleId": "core.DivideZero",
440           "ruleIndex": 2
441         }
442       ],
443       "tool": {
444         "driver": {
445           "fullName": "clang static analyzer",
446           "informationUri": "https://clang.llvm.org/docs/UsersManual.html",
447           "language": "en-US",
448           "name": "clang",
449           "rules": [
450             {
451               "defaultConfiguration": {
452                 "enabled": true,
453                 "level": "warning",
454                 "rank": -1
455               },
456               "fullDescription": {
457                 "text": "Mark tainted symbols as such."
458               },
459               "id": "debug.TaintTest",
460               "name": "debug.TaintTest"
461             },
462             {
463               "defaultConfiguration": {
464                 "enabled": true,
465                 "level": "warning",
466                 "rank": -1
467               },
468               "fullDescription": {
469                 "text": "Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers)"
470               },
471               "helpUri": "https://clang.llvm.org/docs/analyzer/checkers.html#core-callandmessage",
472               "id": "core.CallAndMessage",
473               "name": "core.CallAndMessage"
474             },
475             {
476               "defaultConfiguration": {
477                 "enabled": true,
478                 "level": "warning",
479                 "rank": -1
480               },
481               "fullDescription": {
482                 "text": "Check for division by zero"
483               },
484               "helpUri": "https://clang.llvm.org/docs/analyzer/checkers.html#core-dividezero",
485               "id": "core.DivideZero",
486               "name": "core.DivideZero"
487             },
488             {
489               "defaultConfiguration": {
490                 "enabled": true,
491                 "level": "warning",
492                 "rank": -1
493               },
494               "fullDescription": {
495                 "text": "Check for memory leaks, double free, and use-after-free problems. Traces memory managed by malloc()/free()."
496               },
497               "helpUri": "https://clang.llvm.org/docs/analyzer/checkers.html#unix-malloc",
498               "id": "unix.Malloc",
499               "name": "unix.Malloc"
500             }
501           ],
502         }
503       }
504     }
505   ],