diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-10-26 17:53:41 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-10-26 17:53:41 +0000 |
commit | 3e30010d99b1b9c550d022239095cae9cf715934 (patch) | |
tree | ba00c39cde1cccd825673026b2aa702b6efc17c4 /clang/test/Index | |
parent | 3b1d4f678522905d3b8c596da49db78fd48b28f1 (diff) | |
download | bcm5719-llvm-3e30010d99b1b9c550d022239095cae9cf715934.tar.gz bcm5719-llvm-3e30010d99b1b9c550d022239095cae9cf715934.zip |
Eliminate a hang while loading a sequence of redeclarable entities. In
essence, the redeclaration chain for a class could end up in an
inconsistent state while deserializing multiple declarations in that
chain, where the circular linked list was not, in fact,
circular. Since only two redeclarations of the same entity will get
loaded when we're in this state, restore circularity when both have
been loaded. Fixes <rdar://problem/10324940> / PR11195.
llvm-svn: 143037
Diffstat (limited to 'clang/test/Index')
-rw-r--r-- | clang/test/Index/Inputs/redeclarations.h | 21 | ||||
-rw-r--r-- | clang/test/Index/redeclarations.cpp | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/clang/test/Index/Inputs/redeclarations.h b/clang/test/Index/Inputs/redeclarations.h new file mode 100644 index 00000000000..7f0d7aebb86 --- /dev/null +++ b/clang/test/Index/Inputs/redeclarations.h @@ -0,0 +1,21 @@ +class X +{ + friend class A; +}; + + +template <typename T1, typename T2> +class B +{ +}; + +template <class T> +struct C +{ +}; + +class D +{ + B<D, class A> x; + friend struct C<A>; +}; diff --git a/clang/test/Index/redeclarations.cpp b/clang/test/Index/redeclarations.cpp new file mode 100644 index 00000000000..453d02c272f --- /dev/null +++ b/clang/test/Index/redeclarations.cpp @@ -0,0 +1,21 @@ +#include "redeclarations.h" + +class A +{ +}; + +// RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source-reparse 2 all -I%S/Inputs %s | FileCheck %s + +// CHECK: redeclarations.h:1:7: ClassDecl=X:1:7 (Definition) Extent=[1:1 - 4:2] +// CHECK: redeclarations.h:8:7: ClassTemplate=B:8:7 (Definition) Extent=[7:1 - 10:2] +// CHECK: redeclarations.h:7:20: TemplateTypeParameter=T1:7:20 (Definition) Extent=[7:11 - 7:22] +// CHECK: redeclarations.h:7:33: TemplateTypeParameter=T2:7:33 (Definition) Extent=[7:24 - 7:35] +// CHECK: redeclarations.h:13:8: ClassTemplate=C:13:8 (Definition) Extent=[12:1 - 15:2] +// CHECK: redeclarations.h:12:17: TemplateTypeParameter=T:12:17 (Definition) Extent=[12:11 - 12:18] +// CHECK: redeclarations.h:17:7: ClassDecl=D:17:7 (Definition) Extent=[17:1 - 21:2] +// CHECK: redeclarations.h:19:16: ClassDecl=A:19:16 Extent=[19:10 - 19:17] +// CHECK: redeclarations.h:19:19: FieldDecl=x:19:19 (Definition) Extent=[19:5 - 19:20] +// CHECK: redeclarations.h:19:5: TemplateRef=B:8:7 Extent=[19:5 - 19:6] +// CHECK: redeclarations.h:19:7: TypeRef=class D:17:7 Extent=[19:7 - 19:8] +// CHECK: redeclarations.h:19:16: TypeRef=class A:3:7 Extent=[19:16 - 19:17] +// CHECK: redeclarations.cpp:3:7: ClassDecl=A:3:7 (Definition) Extent=[3:1 - 5:2] |