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

    <tr>
        <th>Summary</th>
        <td>
            Incorrect AST on M2 Mac
        </td>
    </tr>

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

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

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

<pre>
    Clang on my mac M2 is producing an incorrect AST dump.

`clang  -Xclang -ast-dump -fsyntax-only`
 for the following code:
`#include <stdio.h>

// Define the function pointer type for printing
typedef void (*print_func_t)(const char *);

// Define the print function
void print_string(const char *str) {
 printf("%s", str);
}

// Define the macro that uses the function pointer
#define CALL_PRINT_FUNC(print_func, str) (print_func)(str)

// Function that calls the macro with the function pointer
void call_macro_with_func_pointer(const char *str) {
 CALL_PRINT_FUNC(print_string, str);
}

// Example usage
int main(void) {
    call_macro_with_func_pointer("Hello, World!");
 return 0;
}`
as seen here
https://godbolt.org/z/4v9Mhhn5o

should end with:
`-FunctionDecl <line:20:1, line:23:1> line:20:5 main 'int (void)'
  `-CompoundStmt <col:16, line:23:1>
    |-CallExpr <line:21:5, col:49> 'void'
    | |-ImplicitCastExpr <col:5> 'void (*)(const char *)' <FunctionToPointerDecay>
    | | `-DeclRefExpr <col:5> 'void (const char *)' Function 0xbab6f88 'call_macro_with_func_pointer' 'void (const char *)'
    | `-ImplicitCastExpr <col:34> 'const char *' <NoOp>
    | `-ImplicitCastExpr <col:34> 'char *' <ArrayToPointerDecay>
    | `-StringLiteral <col:34> 'char[14]' lvalue "Hello, World!"
 `-ReturnStmt <line:22:5, col:12>
      `-IntegerLiteral <col:12> 'int' 0
`

On my mac M2 it ends with :
`
| |-ParmVarDecl 0x11f8c2828 <col:29, col:34> col:46 'char *restrict'
| |-ParmVarDecl 0x11f8c28a0 <col:48> col:54 'size_t':'unsigned long'
| |-ParmVarDecl 0x11f8c2920 <col:56> col:59 'int'
| |-ParmVarDecl 0x11f8c2998 <col:61> col:67 'size_t':'unsigned long'
| |-ParmVarDecl 0x11f8c2a18 <line:71:8, col:19> col:31 'const char *restrict'
| `-ParmVarDecl 0x11f8c2a90 <col:33> col:40 'va_list':'char *'
|-TypedefDecl 0x11f8c2e30 </private/tmp/51d772ea0bc946e8a17da6e326b3f752.c:5:1, col:42> col:16 print_func_t 'void (*)(const char *)'
| `-PointerType 0x11f8c2dd0 'void (*)(const char *)'
|   `-ParenType 0x11f8c2d70 'void (const char *)' sugar
|     `-FunctionProtoType 0x11f8aee90 'void (const char *)' cdecl
|       |-BuiltinType 0x11f81e870 'void'
|       `-PointerType 0x12007cab0 'const char *'
|         `-QualType 0x11f81e8b1 'const char' const
|           `-BuiltinType 0x11f81e8b0 'char'
`-FunctionDecl 0x11f8c2f30 <line:8:1, line:25:2> line:8:6 print_string 'void (const char *)'
  |-ParmVarDecl 0x11f8c2ea0 <col:19, col:31> col:31 str 'const char *'
  `-CompoundStmt 0x11f8c3000 <col:36, line:25:2>
2 warnings and 2 errors generated.
`

Missing the functions call_macro_with_func_pointer, and main!

clang --version
Homebrew clang version 17.0.1
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysl0tv27oSxz8NvSFsUJStx8KL1K5xArQ9vW3uYxdQ4tjmBUUKJJXH-fQXJKVIcpwHLs6iTSJxfvPXn5zRiFkrTgpgizZf0Ga_YJ07a7OtjGCKPy4qzZ-3O8nUCWuFm2fcsBp_p1hY3BrNu1qoE2YKC1VrY6B2-Ob3HeZd064Q2SNy0_-fkTpA8PI_8Zcls27p1-Hl0T4rx56WWslnlJEYgY_aYHcGfNRS6kefptYcUDoSEU2FqmXHAaN0Zx0XenVG6ddZYnpA9ID3cBQKIq9TtRNa4VYL5cBg99xCyNYaoZxQpxjpL3M44gctOEa0QPQmLLj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