[all-commits] [llvm/llvm-project] 78747b: [clang][WebAssembly] Loosen restriction on `main` ...

Sam Clegg via All-commits all-commits at lists.llvm.org
Wed Jun 15 13:56:34 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 78747bd39af807eb6b56709b9713c303704c47ad
      https://github.com/llvm/llvm-project/commit/78747bd39af807eb6b56709b9713c303704c47ad
  Author: Sam Clegg <sbc at chromium.org>
  Date:   2022-06-15 (Wed, 15 Jun 2022)

  Changed paths:
    M clang/lib/AST/Mangle.cpp
    A clang/test/CodeGen/mangle-wasm-main-noproto.c
    A clang/test/CodeGen/mangle-wasm-main-void.c
    A clang/test/CodeGen/mangle-wasm-main.c

  Log Message:
  -----------
  [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




More information about the All-commits mailing list