[cfe-commits] r124662 - in /cfe/trunk: lib/Serialization/ASTReader.cpp test/PCH/cxx-variadic-templates.cpp test/PCH/cxx-variadic-templates.h

Douglas Gregor dgregor at apple.com
Tue Feb 1 07:24:58 PST 2011


Author: dgregor
Date: Tue Feb  1 09:24:58 2011
New Revision: 124662

URL: http://llvm.org/viewvc/llvm-project?rev=124662&view=rev
Log:
Fix a thinko where I didn't update a consistency check for
PackExpansionType in the AST reader. We need more testing for variadic
templates + PCH, but this fixes PR9073.

Added:
    cfe/trunk/test/PCH/cxx-variadic-templates.cpp   (with props)
    cfe/trunk/test/PCH/cxx-variadic-templates.h   (with props)
Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=124662&r1=124661&r2=124662&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Feb  1 09:24:58 2011
@@ -2964,7 +2964,7 @@
   }
 
   case TYPE_PACK_EXPANSION: {
-    if (Record.size() != 1) {
+    if (Record.size() != 2) {
       Error("incorrect encoding of pack expansion type");
       return QualType();
     }

Added: cfe/trunk/test/PCH/cxx-variadic-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-variadic-templates.cpp?rev=124662&view=auto
==============================================================================
--- cfe/trunk/test/PCH/cxx-variadic-templates.cpp (added)
+++ cfe/trunk/test/PCH/cxx-variadic-templates.cpp Tue Feb  1 09:24:58 2011
@@ -0,0 +1,11 @@
+// Test this without pch.
+// RUN: %clang_cc1 -std=c++0x -include %S/cxx-variadic-templates.h -verify %s -ast-dump -o -
+// RUN: %clang_cc1 -std=c++0x -include %S/cxx-variadic-templates.h %s -emit-llvm -o - | FileCheck %s
+
+// Test with pch.
+// RUN: %clang_cc1 -std=c++0x -x c++-header -emit-pch -o %t %S/cxx-variadic-templates.h
+// RUN: %clang_cc1 -std=c++0x -include-pch %t -verify %s -ast-dump  -o -
+// RUN: %clang_cc1 -std=c++0x -include-pch %t %s -emit-llvm -o - | FileCheck %s
+
+// CHECK: allocate_shared
+shared_ptr<int> spi = shared_ptr<int>::allocate_shared(1, 2);

Propchange: cfe/trunk/test/PCH/cxx-variadic-templates.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/PCH/cxx-variadic-templates.cpp
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/PCH/cxx-variadic-templates.cpp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cfe/trunk/test/PCH/cxx-variadic-templates.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-variadic-templates.h?rev=124662&view=auto
==============================================================================
--- cfe/trunk/test/PCH/cxx-variadic-templates.h (added)
+++ cfe/trunk/test/PCH/cxx-variadic-templates.h Tue Feb  1 09:24:58 2011
@@ -0,0 +1,18 @@
+// PR9073
+template<typename _Tp>
+class shared_ptr{
+public:
+  template<class _Alloc, class ..._Args>
+  static
+  shared_ptr<_Tp>
+  allocate_shared(const _Alloc& __a, _Args&& ...__args);
+};
+
+template<class _Tp>
+template<class _Alloc, class ..._Args>
+shared_ptr<_Tp>
+shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)
+{
+  shared_ptr<_Tp> __r;
+  return __r;
+}

Propchange: cfe/trunk/test/PCH/cxx-variadic-templates.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/PCH/cxx-variadic-templates.h
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cfe/trunk/test/PCH/cxx-variadic-templates.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain





More information about the cfe-commits mailing list