[clang][WebAssembly] Loosen restriction on `main` symbol mangling
commit78747bd39af807eb6b56709b9713c303704c47ad
authorSam Clegg <sbc@chromium.org>
Wed, 15 Jun 2022 18:30:13 +0000 (15 11:30 -0700)
committerSam Clegg <sbc@chromium.org>
Wed, 15 Jun 2022 20:56:05 +0000 (15 13:56 -0700)
treebab4efc81add8677613a7731c0af96cb161d21a5
parentb97b082c5a0d2b1d8a4c18865408aad35844016e
[clang][WebAssembly] Loosen restriction on `main` symbol mangling

Remove the `hasPrototype()` restriction so that old style K&R
declarations of main work too.

For example the following has 2 params but no prototype.

```
int main(argc, argv)
    int argc;
    char *argv[];
{
  return 0;
}
```

Also, use `getNumParams()` over `param_size()` which seems to be a more
direct way to get at the same information.

Also, add missing tests for this mangling.

Differential Revision: https://reviews.llvm.org/D127888
clang/lib/AST/Mangle.cpp
clang/test/CodeGen/mangle-wasm-main-noproto.c [new file with mode: 0644]
clang/test/CodeGen/mangle-wasm-main-void.c [new file with mode: 0644]
clang/test/CodeGen/mangle-wasm-main.c [new file with mode: 0644]