sbc100 created this revision. Herald added subscribers: pmatos, wingo, ecnelises, sunfish, jgravelle-google, dschuff. Herald added a project: All. sbc100 requested review of this revision. Herald added subscribers: cfe-commits, aheejin. Herald added a project: clang.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D127888 Files: clang/lib/AST/Mangle.cpp Index: clang/lib/AST/Mangle.cpp =================================================================== --- clang/lib/AST/Mangle.cpp +++ clang/lib/AST/Mangle.cpp @@ -72,7 +72,7 @@ // can call it with the correct function signature. if (Triple.isWasm()) if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) - if (FD->isMain() && FD->hasPrototype() && FD->param_size() == 2) + if (FD->isMain() && FD->getNumParams() == 2) return CCM_WasmMainArgcArgv; if (!Triple.isOSWindows() || !Triple.isX86())
Index: clang/lib/AST/Mangle.cpp =================================================================== --- clang/lib/AST/Mangle.cpp +++ clang/lib/AST/Mangle.cpp @@ -72,7 +72,7 @@ // can call it with the correct function signature. if (Triple.isWasm()) if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) - if (FD->isMain() && FD->hasPrototype() && FD->param_size() == 2) + if (FD->isMain() && FD->getNumParams() == 2) return CCM_WasmMainArgcArgv; if (!Triple.isOSWindows() || !Triple.isX86())
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits