[cfe-commits] r150963 - in /cfe/trunk: lib/Serialization/ASTReaderStmt.cpp test/PCH/cxx-exprs.cpp
Douglas Gregor
dgregor at apple.com
Mon Feb 20 08:12:14 PST 2012
Author: dgregor
Date: Mon Feb 20 10:12:14 2012
New Revision: 150963
URL: http://llvm.org/viewvc/llvm-project?rev=150963&view=rev
Log:
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>.
Added:
cfe/trunk/test/PCH/cxx-exprs.cpp (with props)
Modified:
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=150963&r1=150962&r2=150963&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Mon Feb 20 10:12:14 2012
@@ -1174,14 +1174,9 @@
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);
Added: cfe/trunk/test/PCH/cxx-exprs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-exprs.cpp?rev=150963&view=auto
==============================================================================
--- cfe/trunk/test/PCH/cxx-exprs.cpp (added)
+++ cfe/trunk/test/PCH/cxx-exprs.cpp Mon Feb 20 10:12:14 2012
@@ -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
Propchange: cfe/trunk/test/PCH/cxx-exprs.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cfe/trunk/test/PCH/cxx-exprs.cpp
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cfe/trunk/test/PCH/cxx-exprs.cpp
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the cfe-commits
mailing list