summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-03-17 02:23:11 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-03-17 02:23:11 +0000
commit15e32fd215fa49c18a7b8681d0b500ceef641769 (patch)
tree845c4718a93973457154d22800133e22ce8b3243 /clang/test
parentcf191adaf5647f32d62cee7eda8e1775666ddba2 (diff)
downloadbcm5719-llvm-15e32fd215fa49c18a7b8681d0b500ceef641769.tar.gz
bcm5719-llvm-15e32fd215fa49c18a7b8681d0b500ceef641769.zip
[modules] Fix bug where an anonymous namespace could cause the containing
namespace to not merge properly. We have an invariant here: after a declaration reads its canonical declaration, it can assume the canonical declaration is fully merged. This invariant can be violated if deserializing some declaration triggers the deserialization of a later declaration, because that later declaration can in turn deserialize a redeclaration of that first declaration before it is fully merged. The anonymous namespace for a namespace gets stored with the first declaration of that namespace, which may be before its parent namespace, so defer loading it until after we've finished merging the surrounding namespace. llvm-svn: 232455
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Modules/Inputs/anon-namespace/a.h1
-rw-r--r--clang/test/Modules/Inputs/anon-namespace/b1.h2
-rw-r--r--clang/test/Modules/Inputs/anon-namespace/b2.h2
-rw-r--r--clang/test/Modules/Inputs/anon-namespace/c.h1
-rw-r--r--clang/test/Modules/Inputs/anon-namespace/module.modulemap3
-rw-r--r--clang/test/Modules/anon-namespace.cpp6
6 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/anon-namespace/a.h b/clang/test/Modules/Inputs/anon-namespace/a.h
new file mode 100644
index 00000000000..fe71f4004e4
--- /dev/null
+++ b/clang/test/Modules/Inputs/anon-namespace/a.h
@@ -0,0 +1 @@
+namespace N {}
diff --git a/clang/test/Modules/Inputs/anon-namespace/b1.h b/clang/test/Modules/Inputs/anon-namespace/b1.h
new file mode 100644
index 00000000000..480e8e46a95
--- /dev/null
+++ b/clang/test/Modules/Inputs/anon-namespace/b1.h
@@ -0,0 +1,2 @@
+namespace N {}
+namespace N { namespace {} }
diff --git a/clang/test/Modules/Inputs/anon-namespace/b2.h b/clang/test/Modules/Inputs/anon-namespace/b2.h
new file mode 100644
index 00000000000..8e7535f3626
--- /dev/null
+++ b/clang/test/Modules/Inputs/anon-namespace/b2.h
@@ -0,0 +1,2 @@
+#include "a.h"
+namespace N {}
diff --git a/clang/test/Modules/Inputs/anon-namespace/c.h b/clang/test/Modules/Inputs/anon-namespace/c.h
new file mode 100644
index 00000000000..fe71f4004e4
--- /dev/null
+++ b/clang/test/Modules/Inputs/anon-namespace/c.h
@@ -0,0 +1 @@
+namespace N {}
diff --git a/clang/test/Modules/Inputs/anon-namespace/module.modulemap b/clang/test/Modules/Inputs/anon-namespace/module.modulemap
new file mode 100644
index 00000000000..3d390d2d4e7
--- /dev/null
+++ b/clang/test/Modules/Inputs/anon-namespace/module.modulemap
@@ -0,0 +1,3 @@
+module a { header "a.h" export * }
+module b { module b1 { header "b1.h" export * } module b2 { header "b2.h" export * } }
+module c { header "c.h" export * }
diff --git a/clang/test/Modules/anon-namespace.cpp b/clang/test/Modules/anon-namespace.cpp
new file mode 100644
index 00000000000..6c085ebc885
--- /dev/null
+++ b/clang/test/Modules/anon-namespace.cpp
@@ -0,0 +1,6 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -I%S/Inputs/anon-namespace -verify %s
+// expected-no-diagnostics
+#include "b1.h"
+#include "c.h"
+using namespace N;
OpenPOWER on IntegriCloud