QualType getFuncType = Context->getFunctionType(Context->getObjCSelType(),
&ArgTys[0], ArgTys.size(),
false /*isVariadic*/);
- SelGetUidFunctionDecl = new FunctionDecl(SourceLocation(),
+ SelGetUidFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
SelGetUidIdent, getFuncType,
FunctionDecl::Extern, false, 0);
}
QualType getFuncType = Context->getFunctionType(Context->getObjCProtoType(),
&ArgTys[0], ArgTys.size(),
false /*isVariadic*/);
- GetProtocolFunctionDecl = new FunctionDecl(SourceLocation(),
+ GetProtocolFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
SelGetProtoIdent, getFuncType,
FunctionDecl::Extern, false, 0);
}
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
false);
- SuperContructorFunctionDecl = new FunctionDecl(SourceLocation(),
+ SuperContructorFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
msgSendIdent, msgSendType,
FunctionDecl::Extern, false, 0);
}
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
true /*isVariadic*/);
- MsgSendFunctionDecl = new FunctionDecl(SourceLocation(),
+ MsgSendFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
msgSendIdent, msgSendType,
FunctionDecl::Extern, false, 0);
}
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
true /*isVariadic*/);
- MsgSendSuperFunctionDecl = new FunctionDecl(SourceLocation(),
+ MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
msgSendIdent, msgSendType,
FunctionDecl::Extern, false, 0);
}
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
true /*isVariadic*/);
- MsgSendStretFunctionDecl = new FunctionDecl(SourceLocation(),
+ MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
msgSendIdent, msgSendType,
FunctionDecl::Extern, false, 0);
}
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
true /*isVariadic*/);
- MsgSendSuperStretFunctionDecl = new FunctionDecl(SourceLocation(),
+ MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context,
+ SourceLocation(),
msgSendIdent, msgSendType,
FunctionDecl::Extern, false, 0);
}
QualType msgSendType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
true /*isVariadic*/);
- MsgSendFpretFunctionDecl = new FunctionDecl(SourceLocation(),
+ MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
msgSendIdent, msgSendType,
FunctionDecl::Extern, false, 0);
}
QualType getClassType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
false /*isVariadic*/);
- GetClassFunctionDecl = new FunctionDecl(SourceLocation(),
+ GetClassFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
getClassIdent, getClassType,
FunctionDecl::Extern, false, 0);
}
QualType getClassType = Context->getFunctionType(Context->getObjCIdType(),
&ArgTys[0], ArgTys.size(),
false /*isVariadic*/);
- GetMetaClassFunctionDecl = new FunctionDecl(SourceLocation(),
+ GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, SourceLocation(),
getClassIdent, getClassType,
FunctionDecl::Extern, false, 0);
}
InitBuiltinVaListType();
QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
- FunctionDecl *New = new FunctionDecl(SourceLocation(), II, R,
- FunctionDecl::Extern, false, 0);
+ FunctionDecl *New = FunctionDecl::Create(Context, SourceLocation(), II, R,
+ FunctionDecl::Extern, false, 0);
// Find translation-unit scope to insert this function into.
if (Scope *FnS = S->getFnParent())
case DeclSpec::SCS_private_extern: SC = FunctionDecl::PrivateExtern;break;
}
- FunctionDecl *NewFD = new FunctionDecl(D.getIdentifierLoc(), II, R, SC,
- D.getDeclSpec().isInlineSpecified(),
- LastDeclarator);
+ bool isInline = D.getDeclSpec().isInlineSpecified();
+ FunctionDecl *NewFD = FunctionDecl::Create(Context, D.getIdentifierLoc(),
+ II, R, SC, isInline,
+ LastDeclarator);
// Handle attributes.
HandleDeclAttributes(NewFD, D.getDeclSpec().getAttributes(),
D.getAttributes());
enum StorageClass {
None, Extern, Static, PrivateExtern
};
+private:
FunctionDecl(SourceLocation L, IdentifierInfo *Id, QualType T,
- StorageClass S = None, bool isInline = false,
- ScopedDecl *PrevDecl = 0)
+ StorageClass S, bool isInline, ScopedDecl *PrevDecl)
: ValueDecl(Function, L, Id, T, PrevDecl),
ParamInfo(0), Body(0), DeclChain(0), SClass(S), IsInline(isInline) {}
virtual ~FunctionDecl();
-
+public:
+ static FunctionDecl *Create(ASTContext &C, SourceLocation L,
+ IdentifierInfo *Id, QualType T,
+ StorageClass S = None, bool isInline = false,
+ ScopedDecl *PrevDecl = 0);
+
Stmt *getBody() const { return Body; }
void setBody(Stmt *B) { Body = B; }