aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/sarif-path-role.c
blob: c5592776bebb1e5425382a0d75093a67b16f5665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-additional-options " -fno-diagnostics-json-formatting -fdiagnostics-format=sarif-file" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib malloc" { ! hostedlib } } */

#include <stdlib.h>

void test_1 (void)
{
  void *ptr = malloc (1024);
#include "sarif-path-role.h"
  free (ptr);
}

/* Verify SARIF output.

     { dg-final { verify-sarif-file } }

   Verify that the artifact for the header has this role, given
   that it's only referenced by an execution path event.

     { dg-final { scan-sarif-file "\"roles\": \\\[\"tracedFile\"\\\]" } }
*/