/// argument and whether this function as a va_list argument.
bool isScanfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg);
- /// hasVAListUse - Return true of the specified builtin uses __builtin_va_list
- /// as an operand or return type.
- bool hasVAListUse(unsigned ID) const {
- return strpbrk(GetRecord(ID).Type, "Aa") != 0;
- }
-
/// isConstWithoutErrno - Return true if this function has no side
/// effects and doesn't read memory, except for possibly errno. Such
/// functions can be const when the MathErrno lang option is
/// in the global scope.
bool CheckObjCDeclScope(Decl *D);
- void InitBuiltinVaListType();
-
/// VerifyIntegerConstantExpression - verifies that an expression is an ICE,
/// and reports the appropriate diagnostics. Returns false on success.
/// Can optionally return the value of the expression.
return S;
}
-void Sema::InitBuiltinVaListType() {
- if (!Context.getBuiltinVaListType().isNull())
- return;
-
- IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");
- NamedDecl *VaDecl = LookupSingleName(TUScope, VaIdent, SourceLocation(),
- LookupOrdinaryName, ForRedeclaration);
- TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);
- Context.setBuiltinVaListType(Context.getTypedefType(VaTypedef));
-}
-
/// LazilyCreateBuiltin - The specified Builtin-ID was first used at
/// file scope. lazily create a decl for it. ForRedeclaration is true
/// if we're creating this built-in in anticipation of redeclaring the
SourceLocation Loc) {
Builtin::ID BID = (Builtin::ID)bid;
- if (Context.BuiltinInfo.hasVAListUse(BID))
- InitBuiltinVaListType();
-
ASTContext::GetBuiltinTypeError Error;
QualType R = Context.GetBuiltinType(BID, Error);
switch (Error) {
Context.setjmp_bufDecl(NewTD);
else if (II->isStr("sigjmp_buf"))
Context.setsigjmp_bufDecl(NewTD);
+ else if (II->isStr("__builtin_va_list"))
+ Context.setBuiltinVaListType(Context.getTypedefType(NewTD));
}
return NewTD;