summaryrefslogtreecommitdiff
path: root/test/PCH
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-06-26 02:41:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-06-26 02:41:25 +0000
commit4fc5089e306fe606f2e3e4fa58063ebab35deb62 (patch)
tree82e43e16b54e97859322844354439885b154e2ed /test/PCH
parent86648b13eb01c0565de7264b27799ba81c7ad060 (diff)
downloadclang-4fc5089e306fe606f2e3e4fa58063ebab35deb62.tar.gz
clang-4fc5089e306fe606f2e3e4fa58063ebab35deb62.tar.bz2
clang-4fc5089e306fe606f2e3e4fa58063ebab35deb62.tar.xz
Lazily deserialize the "first' friend declaration when deserializing a class
declaration. This PCH a little lazier, and breaks a deserialization cycle that causes crashes with modules enabled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/PCH')
-rw-r--r--test/PCH/cxx-friends.cpp8
-rw-r--r--test/PCH/cxx-friends.h25
2 files changed, 32 insertions, 1 deletions
diff --git a/test/PCH/cxx-friends.cpp b/test/PCH/cxx-friends.cpp
index f7d45cea8d..9c75f92f34 100644
--- a/test/PCH/cxx-friends.cpp
+++ b/test/PCH/cxx-friends.cpp
@@ -3,7 +3,11 @@
// Test with pch.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-friends.h
-// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s -error-on-deserialized-decl doNotDeserialize
+
+// Test with modules.
+// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/cxx-friends.h -fmodules
+// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s -error-on-deserialized-decl doNotDeserialize -fmodules
// expected-no-diagnostics
@@ -21,3 +25,5 @@ public:
}
};
int k = PR12585::future_base::setter<int>().f();
+
+Lazy::S *p;
diff --git a/test/PCH/cxx-friends.h b/test/PCH/cxx-friends.h
index 05dcc96066..2d20a4d269 100644
--- a/test/PCH/cxx-friends.h
+++ b/test/PCH/cxx-friends.h
@@ -16,3 +16,28 @@ namespace PR12585 {
int k;
};
}
+
+namespace Lazy {
+ struct S {
+ friend void doNotDeserialize();
+ };
+}
+
+// Reduced testcase from libc++'s <valarray>. Used to crash with modules
+// enabled.
+namespace std {
+
+template <class T> struct valarray;
+
+template <class T> struct valarray {
+ valarray();
+ template <class U> friend struct valarray;
+ template <class U> friend U *begin(valarray<U> &v);
+};
+
+struct gslice {
+ valarray<int> size;
+ gslice() {}
+};
+
+}