Commit f3a299a
committed
ast-exporter: add hack for strlen()
this is really perplexing. somehow the builtin definition of strlen overrides the return type of subsequent redeclarations to unsigned long. this does not seem to happen for other builtins, which happily take size_t as an argument type. it also doesn't seem to override declarations of strlen with incompatible types. but in any case by disabling the strlen builtin we can get a sane type based on its actual written declaration.
a minimal reproducer is: `typedef __SIZE_TYPE__ size_t; size_t strlen(const char* x);`
with `clang -Xclang -ast-dump -fsyntax-only`, this shows `unsigned long` as the return type for both the implicit and explicit declaration of `strlen`. with `-fno-builtin-strlen`, the explicit definition keeps its declared size_t return type.1 parent 5e8b4ba commit f3a299a
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2761 | 2761 | | |
2762 | 2762 | | |
2763 | 2763 | | |
| 2764 | + | |
| 2765 | + | |
2764 | 2766 | | |
2765 | 2767 | | |
2766 | 2768 | | |
| |||
0 commit comments