void setBody(Stmt *B);
void setLazyBody(uint64_t Offset) { Body = Offset; }
+ /// Whether this function is variadic.
+ bool isVariadic() const;
+
/// Whether this function is marked as virtual explicitly.
bool isVirtualAsWritten() const { return IsVirtualAsWritten; }
void setVirtualAsWritten(bool V) { IsVirtualAsWritten = V; }
}
+bool FunctionDecl::isVariadic() const {
+ if (const FunctionProtoType *FT = getType()->getAs<FunctionProtoType>())
+ return FT->isVariadic();
+ return false;
+}
+
Stmt *FunctionDecl::getBody(const FunctionDecl *&Definition) const {
for (redecl_iterator I = redecls_begin(), E = redecls_end(); I != E; ++I) {
if (I->Body) {
bool isVariadic;
if (CurBlock)
isVariadic = CurBlock->isVariadic;
- else if (getCurFunctionDecl()) {
- if (FunctionProtoType* FTP =
- dyn_cast<FunctionProtoType>(getCurFunctionDecl()->getType()))
- isVariadic = FTP->isVariadic();
- else
- isVariadic = false;
- } else {
+ else if (FunctionDecl *FD = getCurFunctionDecl())
+ isVariadic = FD->isVariadic();
+ else
isVariadic = getCurMethodDecl()->isVariadic();
- }
if (!isVariadic) {
Diag(Fn->getLocStart(), diag::err_va_start_used_in_non_variadic_function);