llvm-project/clang/test/CodeGen/mangle-wasm-main.c
Sam Clegg 78747bd39a [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
2022-06-15 13:56:05 -07:00

8 lines
243 B
C

// RUN: %clang_cc1 -emit-llvm %s -o - -triple=wasm32-unknown-unknown | FileCheck %s
int main(int argc, char* argv[]) {
return 0;
}
// CHECK-NOT: __main_void
// CHECK: define i32 @__main_argc_argv(i32 noundef %argc, ptr noundef %argv) #0 {