Deserialize the direct-initialization range of a "new" expression

properly. Previously, we deserialized it but failed to set the
corresponding member in CXXNewExpr. Fixes <rdar://problem/10893600>.

llvm-svn: 150963
This commit is contained in:
Douglas Gregor 2012-02-20 16:12:14 +00:00
parent 7adb189538
commit caf4826e2e
2 changed files with 29 additions and 7 deletions

View File

@ -1174,14 +1174,9 @@ void ASTStmtReader::VisitCXXNewExpr(CXXNewExpr *E) {
E->setOperatorNew(ReadDeclAs<FunctionDecl>(Record, Idx));
E->setOperatorDelete(ReadDeclAs<FunctionDecl>(Record, Idx));
E->AllocatedTypeInfo = GetTypeSourceInfo(Record, Idx);
SourceRange TypeIdParens;
TypeIdParens.setBegin(ReadSourceLocation(Record, Idx));
TypeIdParens.setEnd(ReadSourceLocation(Record, Idx));
E->TypeIdParens = TypeIdParens;
E->TypeIdParens = ReadSourceRange(Record, Idx);
E->StartLoc = ReadSourceLocation(Record, Idx);
SourceRange DirectInitRange;
DirectInitRange.setBegin(ReadSourceLocation(Record, Idx));
DirectInitRange.setEnd(ReadSourceLocation(Record, Idx));
E->DirectInitRange = ReadSourceRange(Record, Idx);
E->AllocateArgsArray(Reader.getContext(), isArray, NumPlacementArgs,
E->StoredInitializationStyle != 0);

View File

@ -0,0 +1,27 @@
// Test this without pch.
// RUN: %clang_cc1 -include %s -verify -std=c++11 %s
// Test with pch.
// RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
// RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s
#ifndef HEADER
#define HEADER
template<typename T>
class New {
New(const New&);
public:
New *clone() {
return new New(*this);
}
};
#else
New<int> *clone_new(New<int> *n) {
return n->clone();
}
#endif