diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-08-03 16:26:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-08-03 16:26:46 +0000 |
commit | 0bbea1b87ef3849f5a8591c480f114fb4393d493 (patch) | |
tree | 2debaa7f1996e2a5744e164c086813936c490135 /lib/Sema/SemaDecl.cpp | |
parent | 4192f0336e86532904b82ae63cd57b966f1c6dfd (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4988323f41..2b6cf312a1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -8308,13 +8308,14 @@ void Sema::ActOnLastBitfield(SourceLocation DeclLoc, Decl *EnclosingDecl, 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); |