| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fdiagnostics-format=sarif-file -Wmisleading-indentation" } */ |
| 3 |
|
| 4 |
int test (void) |
| 5 |
{ |
| 6 |
if (1) |
| 7 |
return 3; |
| 8 |
return 4; |
| 9 |
return 5; |
| 10 |
} |
| 11 |
|
| 12 |
/* |
| 13 |
{ dg-final { verify-sarif-file } } |
| 14 |
|
| 15 |
{ dg-final { scan-sarif-file "\"level\": \"warning\"" } } |
| 16 |
{ dg-final { scan-sarif-file "\"ruleId\": \"-Wmisleading-indentation\"" } } |
| 17 |
{ dg-final { scan-sarif-file "\"text\": \" if " } } |
| 18 |
|
| 19 |
{ dg-final { scan-sarif-file "\"locations\": \\\[" } } |
| 20 |
|
| 21 |
We expect a logical location for the error (within fn "test"): |
| 22 |
{ dg-final { scan-sarif-file "\"logicalLocations\": \\\[" } } |
| 23 |
{ dg-final { scan-sarif-file "\"kind\": \"function\"" } } |
| 24 |
{ dg-final { scan-sarif-file "\"name\": \"test\"" } } |
| 25 |
{ dg-final { scan-sarif-file "\"fullyQualifiedName\": \"test\"" } } |
| 26 |
{ dg-final { scan-sarif-file "\"decoratedName\": \"" } } |
| 27 |
|
| 28 |
We expect the "note" to become a "relatedLocations" entry: |
| 29 |
{ dg-final { scan-sarif-file "\"relatedLocations\": \\\[" } } |
| 30 |
{ dg-final { scan-sarif-file "\"text\": \" return 4;" } } |
| 31 |
*/ |