@@ -42,6 +42,7 @@ $(GNAME TraitsKeyword):
4242 $(GBLINK getAliasThis)
4343 $(GBLINK getAttributes)
4444 $(GBLINK getFunctionAttributes)
45+ $(GBLINK getFunctionVariadicStyle)
4546 $(GBLINK getMember)
4647 $(GBLINK getOverloads)
4748 $(GBLINK getPointerBitmap)
@@ -442,6 +443,43 @@ tuple((Foo))
442443)
443444)
444445
446+ $(SECTION2 $(GNAME getFunctionVariadicStyle),
447+ $(P
448+ Takes one argument which must either be a function symbol, or a type
449+ that is a function, delegate or a function pointer.
450+
451+ It returns a string identifying the kind of
452+ $(LINK2 function.html#variadic, variadic arguments) that are supported.
453+ )
454+
455+ $(TABLE2 getFunctionVariadicStyle,
456+ $(THEAD string returned, kind, access, example)
457+ $(TROW $(D "none"), not a variadic function, , $(D void foo();))
458+ $(TROW $(D "argptr"), D style variadic function, $(D _argptr) and $(D _arguments), $(D void bar(...)))
459+ $(TROW $(D "stdarg"), C style variadic function, $(LINK2 $(ROOT_DIR)phobos/core_stdc_stdarg.html, $(D core.stdc.stdarg)), $(D extern (C) void abc(int, ...)))
460+ $(TROW $(D "typesafe"), typesafe variadic function, array on stack, $(D void def(int[] ...)))
461+ )
462+
463+ ---
464+ import core.stdc.stdarg;
465+
466+ void novar() {}
467+ extern(C) void cstyle(int, ...) {}
468+ extern(C++) void cppstyle(int, ...) {}
469+ void dstyle(...) {}
470+ void typesafe(int[]...) {}
471+
472+ static assert(__traits(getFunctionVariadicStyle, novar) == "none");
473+ static assert(__traits(getFunctionVariadicStyle, cstyle) == "stdarg");
474+ static assert(__traits(getFunctionVariadicStyle, cppstyle) == "stdarg");
475+ static assert(__traits(getFunctionVariadicStyle, dstyle) == "argptr");
476+ static assert(__traits(getFunctionVariadicStyle, typesafe) == "typesafe");
477+
478+ static assert(__traits(getFunctionVariadicStyle, (int[] a...) {}) == "typesafe");
479+ static assert(__traits(getFunctionVariadicStyle, typeof(cstyle)) == "stdarg");
480+ ---
481+ )
482+
445483$(SECTION2 $(GNAME getFunctionAttributes),
446484 $(P
447485 Takes one argument which must either be a function symbol, function literal,
0 commit comments