[libc-commits] [PATCH] D90800: [libc] Fix WrapperGen seeing no arguments as a void argument.
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Thu Nov 5 10:31:47 PST 2020
michaelrj updated this revision to Diff 303164.
michaelrj added a comment.
add check for a void argument as well as other arguments in the same function.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90800/new/
https://reviews.llvm.org/D90800
Files:
libc/utils/tools/WrapperGen/Main.cpp
Index: libc/utils/tools/WrapperGen/Main.cpp
===================================================================
--- libc/utils/tools/WrapperGen/Main.cpp
+++ libc/utils/tools/WrapperGen/Main.cpp
@@ -47,6 +47,20 @@
for (size_t i = 0; i < ArgsList.size(); ++i) {
llvm::Record *ArgType = ArgsList[i]->getValueAsDef("ArgType");
auto TypeName = Indexer.getTypeAsString(ArgType);
+
+ if (TypeName.compare("void") == 0) {
+ if (ArgsList.size() == 1) {
+ break;
+ } else {
+ // the reason this is a fatal error is that a void argument means this
+ // function has no arguments; multiple copies of no arguments is an
+ // error.
+ llvm::PrintFatalError(
+ "Function '" + FunctionName +
+ "' has an argument of type 'void' and other arguments.");
+ }
+ }
+
OS << TypeName << " " << ArgPrefix << i;
CallArgs << ArgPrefix << i;
if (i < ArgsList.size() - 1) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90800.303164.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20201105/116f2b57/attachment-0001.bin>
More information about the libc-commits
mailing list