<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/102498>102498</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            JSON Dumper is omitting OMP clause information
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          goldenskans
      </td>
    </tr>
</table>

<pre>
    When using the  "-ast-dump=json" flag, the generated AST information in the JSON file is missing information about OpenMP clauses. Directives seem to show up fine, but not any associated clauses. In comparison, the text output using just "-ast-dump" does contain both the directives and their clauses.

Put the following snippet of code in a file called "noOMPClauseInJSON.cpp"
```c++
#include <omp.h>

#define SIZE 5

void test(int *a, int *b, int *c, int size)
{
    int i;
    #pragma omp parallel
    {
 #pragma omp for nowait
        for (i = 0; i < size; i++)
 b[i] = a[i] * a[i];

        #pragma omp for nowait
        for (i = 0; i < size; i++)
            c[i] = a[i]/2;
    }
}
``` 

Clang command:
```shell
% clang -fsyntax-only -fno-color-diagnostics -Xclang -ast-dump=json -x c++ -fopenmp "~/noOMPClauseInJSON.cpp" -v > "~/noOMPClauseInJSON.json"
``` 

Do a search for the "OMPForDirective" in the JSON file and note there is no "OMPNowaitClause" after it. There is however and empty child section "{ }" that is presumably where the information for the clause should appear. Compare that to text output by repeating the same clang command but remove "=json" and change the file extension for the output to ".txt". Search again for "OMPForDirective" and note that the "OMPNowaitClause" appears immediately after its associated "OMPForDirective".

This makes it difficult to build accurate tooling using the AST output since the JSON is easier to consume than the text output.

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU9v27gT_TT0ZSBDpuzYPuiQxDXQH9AmQAr8FnujyJHEliIFcuTEe9jPviAlO3La7m0Nw6bI-fPmcfRGhKAbi1iyzQPbHBZioNb5snFGoQ0_hA2Lyqlz-f8WLQxB2waoRQDGeSYCZWroelYcvgdnGedQ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