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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy, question]: can I determine if an AST node is synthesised?
        </td>
    </tr>

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

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

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

<pre>
    Hi,

I am trying to write a new check that bans certain builtin functions (e.g. `__builtin_memcpy`), if they are used by the user directly. My check matches on CallExpr and I then get the name of the function called, etc.

My check basically works, but there is one very odd example where it does not.

```
preprocessed_potato.cpp:12345:7: warning: __builtin_memcpy is not an allowed builtin
class FlagMatrix
 ^
```

Barring bugs in clang, I guess there is a legitimate reason why this node was synthesised and inserted into the tree. Is there a way to figure out if such a node is "coming from source"?

I've read https://clang.llvm.org/doxygen/classclang_1_1CallExpr.html but I couldn't find anything obvious.

I am trying to get a small reproducer but I am having trouble with that as its a lot of internal code full of templates that is hard to reduce. However I was hoping it was maybe a common/obvious problem.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8lM2O2zYQx5-GvgwiyJQ_Dz442RjxIaf2bozIkcSGIlVyZK_evhh6s8kWRQFDpjTkfP1_HMzZ9YHopLaf1fZlhTMPMZ06H5PDkM2AweKqjXY5fXNKf1H1i6rPz-cVcAROiws9cIRHckyAEOgBZiDzA3hAhhZDBkOJ0QVoZ-fZBejmYNjFkEHpA1V9BWpX325v5ttIo5kWtauVPir9BVwHPNACmAjmTBbaRT7IOoF1iQz7pYLvy1vgEdkMlCEG-ILef32dEmCwcJVTAXricjzgSBCL7_eMwKD3ZCUqsal-r_fdfYvZybYFHjH9yLK3nYvLROAkLMGd0gLRWqBXHCdP8HhaGWykDCHyB99S6_NXXqdEU4qGciZ7myIjx8pMk2rOa91stqo571Vzhgem4EIvy383T_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