[cfe-commits] r136786 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Douglas Gregor dgregor at apple.com
Wed Aug 3 09:26:47 PDT 2011


Author: dgregor
Date: Wed Aug  3 11:26:46 2011
New Revision: 136786

URL: http://llvm.org/viewvc/llvm-project?rev=136786&view=rev
Log:
Make the type of the IntegerLiteral for bitfield paddings an actual
integer, and initialise its TypeSourceInfo. The initialisation fixes a
crash when using pre-compiled preambles with C++ code-completion. From
Erik Verbruggen! Fixes PR10511.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=136786&r1=136785&r2=136786&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Aug  3 11:26:46 2011
@@ -8308,13 +8308,14 @@
       return;
   }
   // All conditions are met. Add a new bitfield to the tail end of ivars.
-  llvm::APInt Zero(Context.getTypeSize(Context.CharTy), 0);
-  Expr * BW = IntegerLiteral::Create(Context, Zero, Context.CharTy, DeclLoc);
+  llvm::APInt Zero(Context.getTypeSize(Context.IntTy), 0);
+  Expr * BW = IntegerLiteral::Create(Context, Zero, Context.IntTy, DeclLoc);
 
   Ivar = ObjCIvarDecl::Create(Context, cast<ObjCContainerDecl>(EnclosingDecl),
                               DeclLoc, DeclLoc, 0,
                               Context.CharTy, 
-                              Context.CreateTypeSourceInfo(Context.CharTy),
+                              Context.getTrivialTypeSourceInfo(Context.CharTy,
+                                                               DeclLoc),
                               ObjCIvarDecl::Private, BW,
                               true);
   AllIvarDecls.push_back(Ivar);





More information about the cfe-commits mailing list