diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-12-14 00:03:17 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-12-14 00:03:17 +0000 |
commit | 30e304e2a646ccd5f34d5697cad0be9dcccfaa2d (patch) | |
tree | 163bb6f813594df2306fc76c0ec4241e296b8fb9 /clang/lib/Serialization/ASTReader.cpp | |
parent | 54eb192b25aa766142e19203361f2d91f21b7263 (diff) | |
download | bcm5719-llvm-30e304e2a646ccd5f34d5697cad0be9dcccfaa2d.tar.gz bcm5719-llvm-30e304e2a646ccd5f34d5697cad0be9dcccfaa2d.zip |
Remove custom handling of array copies in lambda by-value array capture and
copy constructors of classes with array members, instead using
ArrayInitLoopExpr to represent the initialization loop.
This exposed a bug in the static analyzer where it was unable to differentiate
between zero-initialized and unknown array values, which has also been fixed
here.
llvm-svn: 289618
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 4f12f862578..f4b7392df26 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -8167,49 +8167,29 @@ ASTReader::ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record, Expr *Init = ReadExpr(F); SourceLocation LParenLoc = ReadSourceLocation(F, Record, Idx); SourceLocation RParenLoc = ReadSourceLocation(F, Record, Idx); - bool IsWritten = Record[Idx++]; - unsigned SourceOrderOrNumArrayIndices; - SmallVector<VarDecl *, 8> Indices; - if (IsWritten) { - SourceOrderOrNumArrayIndices = Record[Idx++]; - } else { - SourceOrderOrNumArrayIndices = Record[Idx++]; - Indices.reserve(SourceOrderOrNumArrayIndices); - for (unsigned i = 0; i != SourceOrderOrNumArrayIndices; ++i) - Indices.push_back(ReadDeclAs<VarDecl>(F, Record, Idx)); - } CXXCtorInitializer *BOMInit; - if (Type == CTOR_INITIALIZER_BASE) { + if (Type == CTOR_INITIALIZER_BASE) BOMInit = new (Context) CXXCtorInitializer(Context, TInfo, IsBaseVirtual, LParenLoc, Init, RParenLoc, MemberOrEllipsisLoc); - } else if (Type == CTOR_INITIALIZER_DELEGATING) { + else if (Type == CTOR_INITIALIZER_DELEGATING) BOMInit = new (Context) CXXCtorInitializer(Context, TInfo, LParenLoc, Init, RParenLoc); - } else if (IsWritten) { - if (Member) - BOMInit = new (Context) CXXCtorInitializer( - Context, Member, MemberOrEllipsisLoc, LParenLoc, Init, RParenLoc); - else - BOMInit = new (Context) - CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc, - LParenLoc, Init, RParenLoc); - } else { - if (IndirectMember) { - assert(Indices.empty() && "Indirect field improperly initialized"); - BOMInit = new (Context) - CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc, - LParenLoc, Init, RParenLoc); - } else { - BOMInit = CXXCtorInitializer::Create( - Context, Member, MemberOrEllipsisLoc, LParenLoc, Init, RParenLoc, - Indices.data(), Indices.size()); - } + else if (Member) + BOMInit = new (Context) + CXXCtorInitializer(Context, Member, MemberOrEllipsisLoc, LParenLoc, + Init, RParenLoc); + else + BOMInit = new (Context) + CXXCtorInitializer(Context, IndirectMember, MemberOrEllipsisLoc, + LParenLoc, Init, RParenLoc); + + if (bool IsWritten = Record[Idx++]) { + unsigned SourceOrder = Record[Idx++]; + BOMInit->setSourceOrder(SourceOrder); } - if (IsWritten) - BOMInit->setSourceOrder(SourceOrderOrNumArrayIndices); CtorInitializers[i] = BOMInit; } |