[llvm-branch-commits] [cfe-branch] r115675 - in /cfe/branches/Apple/whitney: include/clang/Basic/Builtins.h include/clang/Sema/Sema.h lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp

Daniel Dunbar daniel at zuster.org
Tue Oct 5 13:55:41 PDT 2010


Author: ddunbar
Date: Tue Oct  5 15:55:41 2010
New Revision: 115675

URL: http://llvm.org/viewvc/llvm-project?rev=115675&view=rev
Log:
Merge r115621:
--
Author: Douglas Gregor <dgregor at apple.com>
Date:   Tue Oct 5 15:41:24 2010 +0000

    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/branches/Apple/whitney/include/clang/Basic/Builtins.h
    cfe/branches/Apple/whitney/include/clang/Sema/Sema.h
    cfe/branches/Apple/whitney/lib/Sema/SemaDecl.cpp
    cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp

Modified: cfe/branches/Apple/whitney/include/clang/Basic/Builtins.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Basic/Builtins.h?rev=115675&r1=115674&r2=115675&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Basic/Builtins.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Basic/Builtins.h Tue Oct  5 15:55:41 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/branches/Apple/whitney/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/include/clang/Sema/Sema.h?rev=115675&r1=115674&r2=115675&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/include/clang/Sema/Sema.h (original)
+++ cfe/branches/Apple/whitney/include/clang/Sema/Sema.h Tue Oct  5 15:55:41 2010
@@ -4256,8 +4256,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/branches/Apple/whitney/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaDecl.cpp?rev=115675&r1=115674&r2=115675&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaDecl.cpp Tue Oct  5 15:55:41 2010
@@ -769,17 +769,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
@@ -789,9 +778,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) {
@@ -2609,6 +2595,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/branches/Apple/whitney/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp?rev=115675&r1=115674&r2=115675&view=diff
==============================================================================
--- cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/Apple/whitney/lib/Sema/SemaExpr.cpp Tue Oct  5 15:55:41 2010
@@ -7438,8 +7438,6 @@
                                             SourceLocation RPLoc) {
   Expr *OrigExpr = E;
 
-  InitBuiltinVaListType();
-
   // Get the va_list type
   QualType VaListType = Context.getBuiltinVaListType();
   if (VaListType->isArrayType()) {





More information about the llvm-branch-commits mailing list