if (i+1 < numArgs)
FdStr += ", ";
}
- FdStr += ");\n";
+ if (FD->isVariadic()) {
+ FdStr += (numArgs > 0) ? ", ...);\n" : "...);\n";
+ }
+ else
+ FdStr += ");\n";
InsertText(FunLocStart, FdStr);
}
/// extern "C" or extern "C" {...}
static SourceLocation getFunctionSourceLocation (RewriteModernObjC &R,
FunctionDecl *FD) {
- if (!FD->isExternC() || FD->isMain()) {
- if (FD->getStorageClassAsWritten() != SC_None)
- R.RewriteBlockLiteralFunctionDecl(FD);
- return FD->getTypeSpecStartLoc();
- }
- const DeclContext *DC = FD->getDeclContext();
- if (const LinkageSpecDecl *LSD = dyn_cast<LinkageSpecDecl>(DC)) {
- SourceLocation BodyRBrace = LSD->getRBraceLoc();
- // if it is extern "C" {...}, return function decl's own location.
- if (BodyRBrace.isValid())
- return FD->getTypeSpecStartLoc();
- return LSD->getExternLoc();
- }
+ if (FD->isExternC() && !FD->isMain()) {
+ const DeclContext *DC = FD->getDeclContext();
+ if (const LinkageSpecDecl *LSD = dyn_cast<LinkageSpecDecl>(DC))
+ // if it is extern "C" {...}, return function decl's own location.
+ if (!LSD->getRBraceLoc().isValid())
+ return LSD->getExternLoc();
+ }
+ if (FD->getStorageClassAsWritten() != SC_None)
+ R.RewriteBlockLiteralFunctionDecl(FD);
return FD->getTypeSpecStartLoc();
}
char CFStringGetTypeID();
void x(void (^)());
-static void initStatics() {
+static void initStatics(int arg, ...) {
x(^{
stringtype = CFStringGetTypeID();
});
}
+static void initStatics1(...) {
+ x(^{
+ stringtype = CFStringGetTypeID();
+ });
+}
+static void initStatics2() {
+ x(^{
+ stringtype = CFStringGetTypeID();
+ });
+}
+