<font size="2"><font face="tahoma,sans-serif">This most possibly fixed <a href="http://llvm.org/bugs/show_bug.cgi?id=8284">http://llvm.org/bugs/show_bug.cgi?id=8284</a> , thanx!<br></font></font><br><div class="gmail_quote">

On Tue, Oct 5, 2010 at 6:41 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Author: dgregor<br>
Date: Tue Oct  5 10:41:24 2010<br>
New Revision: 115621<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=115621&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=115621&view=rev</a><br>
Log:<br>
Register the __builtin_va_list_type node when we parse it, rather than<br>
waiting until we think we need it: we didn't catch all of the places<br>
where we actually needed it, and we probably wouldn't ever. Fixes a<br>
C++ PCH crasher.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/Builtins.h<br>
    cfe/trunk/include/clang/Sema/Sema.h<br>
    cfe/trunk/lib/Sema/SemaDecl.cpp<br>
    cfe/trunk/lib/Sema/SemaExpr.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/Builtins.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=115621&r1=115620&r2=115621&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.h?rev=115621&r1=115620&r2=115621&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/include/clang/Basic/Builtins.h (original)<br>
+++ cfe/trunk/include/clang/Basic/Builtins.h Tue Oct  5 10:41:24 2010<br>
@@ -124,12 +124,6 @@<br>
   /// argument and whether this function as a va_list argument.<br>
   bool isScanfLike(unsigned ID, unsigned &FormatIdx, bool &HasVAListArg);<br>
<br>
-  /// hasVAListUse - Return true of the specified builtin uses __builtin_va_list<br>
-  /// as an operand or return type.<br>
-  bool hasVAListUse(unsigned ID) const {<br>
-    return strpbrk(GetRecord(ID).Type, "Aa") != 0;<br>
-  }<br>
-<br>
   /// isConstWithoutErrno - Return true if this function has no side<br>
   /// effects and doesn't read memory, except for possibly errno. Such<br>
   /// functions can be const when the MathErrno lang option is<br>
<br>
Modified: cfe/trunk/include/clang/Sema/Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=115621&r1=115620&r2=115621&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=115621&r1=115620&r2=115621&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/include/clang/Sema/Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Oct  5 10:41:24 2010<br>
@@ -4253,8 +4253,6 @@<br>
   /// in the global scope.<br>
   bool CheckObjCDeclScope(Decl *D);<br>
<br>
-  void InitBuiltinVaListType();<br>
-<br>
   /// VerifyIntegerConstantExpression - verifies that an expression is an ICE,<br>
   /// and reports the appropriate diagnostics. Returns false on success.<br>
   /// Can optionally return the value of the expression.<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=115621&r1=115620&r2=115621&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=115621&r1=115620&r2=115621&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Oct  5 10:41:24 2010<br>
@@ -771,17 +771,6 @@<br>
   return S;<br>
 }<br>
<br>
-void Sema::InitBuiltinVaListType() {<br>
-  if (!Context.getBuiltinVaListType().isNull())<br>
-    return;<br>
-<br>
-  IdentifierInfo *VaIdent = &Context.Idents.get("__builtin_va_list");<br>
-  NamedDecl *VaDecl = LookupSingleName(TUScope, VaIdent, SourceLocation(),<br>
-                                       LookupOrdinaryName, ForRedeclaration);<br>
-  TypedefDecl *VaTypedef = cast<TypedefDecl>(VaDecl);<br>
-  Context.setBuiltinVaListType(Context.getTypedefType(VaTypedef));<br>
-}<br>
-<br>
 /// LazilyCreateBuiltin - The specified Builtin-ID was first used at<br>
 /// file scope.  lazily create a decl for it. ForRedeclaration is true<br>
 /// if we're creating this built-in in anticipation of redeclaring the<br>
@@ -791,9 +780,6 @@<br>
                                      SourceLocation Loc) {<br>
   Builtin::ID BID = (Builtin::ID)bid;<br>
<br>
-  if (Context.BuiltinInfo.hasVAListUse(BID))<br>
-    InitBuiltinVaListType();<br>
-<br>
   ASTContext::GetBuiltinTypeError Error;<br>
   QualType R = Context.GetBuiltinType(BID, Error);<br>
   switch (Error) {<br>
@@ -2627,6 +2613,8 @@<br>
         Context.setjmp_bufDecl(NewTD);<br>
       else if (II->isStr("sigjmp_buf"))<br>
         Context.setsigjmp_bufDecl(NewTD);<br>
+      else if (II->isStr("__builtin_va_list"))<br>
+        Context.setBuiltinVaListType(Context.getTypedefType(NewTD));<br>
     }<br>
<br>
   return NewTD;<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=115621&r1=115620&r2=115621&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=115621&r1=115620&r2=115621&view=diff</a><br>


==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Oct  5 10:41:24 2010<br>
@@ -7437,8 +7437,6 @@<br>
                                             SourceLocation RPLoc) {<br>
   Expr *OrigExpr = E;<br>
<br>
-  InitBuiltinVaListType();<br>
-<br>
   // Get the va_list type<br>
   QualType VaListType = Context.getBuiltinVaListType();<br>
   if (VaListType->isArrayType()) {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br>