Add __builtin_va_start to the list of builtins, make __builtin_va_list available to builtin functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42857 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 406a745..a140265 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -137,7 +137,16 @@
Scope *S) {
Builtin::ID BID = (Builtin::ID)bid;
- QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
+ if (BID == Builtin::BI__builtin_va_start &&
+ Context.getBuiltinVaListType().isNull()) {
+ IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");
+ ScopedDecl *VaDecl = LookupScopedDecl(VaIdent, Decl::IDNS_Ordinary,
+ SourceLocation(), TUScope);
+ TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);
+ Context.setBuiltinVaListType(Context.getTypedefType(VaTypedef));
+ }
+
+ QualType R = Context.BuiltinInfo.GetBuiltinType(BID, Context);
FunctionDecl *New = new FunctionDecl(SourceLocation(), II, R,
FunctionDecl::Extern, false, 0);