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

    <tr>
        <th>Summary</th>
        <td>
            Different behavior when parsing C++ on Linux/Windows and Mac (python libclang)
        </td>
    </tr>

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

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

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

<pre>
    Hi,

I'm parsing C++ using python's wrapper libclang.
I have a [small tool](https://github.com/tierra-colada/cppguts/blob/main/cppguts/dumpcpp.py) for dumping C++ file and it works pretty stable on Windows and Linux.

The difficulties appear when I'm trying to dump the file [qSlicerViewControllersModule.cxx](https://github.com/Slicer/Slicer/blob/master/Modules/Loadable/ViewControllers/qSlicerViewControllersModule.cxx) on MacOS 10.15.7.

I do that with the command:
```
dumpcpp --file=/path/to/ViewControllers/qSlicerViewControllersModule.cxx -std=c++17 --config /path/to/qSlicerViewControllersModule_includes.cfg --object-name readDefaultSliceViewSettings
```

`qSlicerViewControllersModule_includes.cfg` contains include dirs (all the necessary includes are there as they are given from the CMake);
[readDefaultSliceViewSettings](https://github.com/Slicer/Slicer/blob/80869f11bc507ddf60449014c3c11878cd4d9068/Modules/Loadable/ViewControllers/qSlicerViewControllersModule.cxx#L196) name of a function that I'm interested in (to be dumped).

On MacOS the argument `vtkMRMLScene*` in the function [setMRMLScene(vtkMRMLScene* scene)](https://github.com/Slicer/Slicer/blob/80869f11bc507ddf60449014c3c11878cd4d9068/Modules/Loadable/ViewControllers/qSlicerViewControllersModule.cxx#L91) leads to fail. For example if I change it to `vtkMRMLScene` (remove asterisk - pointer sign) then it works fine. But the if it is a pointer then the objective function `readDefaultSliceViewSettings` is not dumped as it goes after the breaking `vtkMRMLScene*` argument.

This happen only on MacOS. On Linux and Windows I'm able to get the objective function dumped.

So what may be the reason for that?
Is there any chances that on MacOS I have preinstalled Apple clang and python's clang uses Apple clang? If so how to check that?
I tried to delete `libclange.dylib` from `/site-packages/clang/native/` dir but then I'm not able to import clang package to python.

I use the same `libclang` version 14.01 on all the OS installed with `pip install libclang`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVstu4zYU_Rp5Q1jQww9p4cUkQdAACQZoinY5oChKZi2RKknF8d_3XEpOHGOaKQbdFBBsiSLv49xzz1Vl6tPuFxVlt1FyFyVfpt-HKNv2bODWKd2y2yi7wcXG8DSc_N5obHDsaPkwSMs6VYmO6zaeT7M9f5GMs2h943redcwb00Xruygr9t4PLsq_RNk9rlb5_VjFwvR48Epay5fCdLzmeBbD0I7e4a7qTIW_niv9Yb0e-wFP8XCKspI1xjJauQy5UR0C0TVTnh2NPTg2WOn9iTnPK7wymv2hdG2OLux6VHp8jS-R-G0vWa2aRomxQ4DYhoy5Zce91GyCydsTufQmeGceJ4JbZP_Xc6eEtL8rebw12lvTddK6J1OPnYzF6-sPMZnOX968YeF8eJ6MERqPBrghKdxeOcTKDyMBgADjiYuvzyxN4nQdbz8A8cBqg9w4cESAIUuE2AM1inzauEnmKzzO1WHLJcER5Uj1fuB-T6U2PxUkWzoPd3diqm66hW1hdKNadmX7M0vflBbdWEsXi6aFBVP9KYVfat5LZiWv72TDUexggQw8gzAosPtukm-L_9oj9gI57UFmx-YXoJh1yKEIzQJotRTSOW5P5x0gnpX0Cr_c0c0prLTqBURsrOnDudsnfgAByii_mSNb33ya008TsEiKTdmkaSXWybaum02yWpVJuhK5SNNiW4h6VZfJpvgvKZo_puWGmBpqZRpITDNq4RWYG6g5NaTSaA2J_kDba0IVrVnJ0J2yxvEPvP56Jj3Bx2079lJ7hiK9-MPTr0-Pz0JqxEslJmuhu88-Sd-kv9hVXB1ibrop_284lynB3IE5joSt4aqL2T0EVr7yfoC4qYY9MLGH6EvSVuy5hgx4IWUre0OzgNRKuQNbssGE-jCnWk1OPCnpmzw3SsuY3Yw-IA0veKNA_rdj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