[cfe-commits] r115621 - in /cfe/trunk: include/clang/Basic/Builtins.h include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp
Douglas Gregor
dgregor at apple.com
Tue Oct 5 08:41:24 PDT 2010
Author: dgregor
Date: Tue Oct 5 10:41:24 2010
New Revision: 115621
URL: http://llvm.org/viewvc/llvm-project?rev=115621&view=rev
Log:
Register the __builtin_va_list_type node when we parse it, rather than
waiting until we think we need it: we didn't catch all of the places
where we actually needed it, and we probably wouldn't ever. Fixes a
C++ PCH crasher.
Modified:
cfe/trunk/include/clang/Basic/Builtins.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/include/clang/Basic/Builtins.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=115621&r1=115620&r2=115621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Builtins.h (original)
+++ cfe/trunk/include/clang/Basic/Builtins.h Tue Oct 5 10:41:24 2010
@@ -124,12 +124,6 @@
/// 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
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=115621&r1=115620&r2=115621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct 5 10:41:24 2010
@@ -4253,8 +4253,6 @@
/// 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.
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=115621&r1=115620&r2=115621&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Oct 5 10:41:24 2010
@@ -771,17 +771,6 @@
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
@@ -791,9 +780,6 @@
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) {
@@ -2627,6 +2613,8 @@
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;
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=115621&r1=115620&r2=115621&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Oct 5 10:41:24 2010
@@ -7437,8 +7437,6 @@
SourceLocation RPLoc) {
Expr *OrigExpr = E;
- InitBuiltinVaListType();
-
// Get the va_list type
QualType VaListType = Context.getBuiltinVaListType();
if (VaListType->isArrayType()) {
More information about the cfe-commits
mailing list