summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-07 09:11:48 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-07 09:11:48 +0000
commite57e752b71f0254e697156ed8c5c15040f53e6d6 (patch)
treea6b6d287391aff05c487f0cb9043cbb91353c5e7 /clang/test/Modules
parent43a1bd6ac7caf826c024eb05507b3c8fe8956dc3 (diff)
downloadbcm5719-llvm-e57e752b71f0254e697156ed8c5c15040f53e6d6.tar.gz
bcm5719-llvm-e57e752b71f0254e697156ed8c5c15040f53e6d6.zip
Switch NamespaceDecl from its own hand-rolled redeclaration chain over
to Redeclarable<NamespaceDecl>, so that we benefit from the improveed redeclaration deserialization and merging logic provided by Redeclarable<T>. Otherwise, no functionality change. As a drive-by fix, collapse the "inline" bit into the low bit of the original namespace/anonymous namespace, saving 8 bytes per NamespaceDecl on x86_64. llvm-svn: 147729
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/module.map12
-rw-r--r--clang/test/Modules/Inputs/namespaces-left.h11
-rw-r--r--clang/test/Modules/Inputs/namespaces-right.h18
-rw-r--r--clang/test/Modules/Inputs/namespaces-top.h11
-rw-r--r--clang/test/Modules/namespaces.cpp15
5 files changed, 67 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/module.map b/clang/test/Modules/Inputs/module.map
index 640aa3c1f63..2819e62b8f1 100644
--- a/clang/test/Modules/Inputs/module.map
+++ b/clang/test/Modules/Inputs/module.map
@@ -63,3 +63,15 @@ module redecl_merge_bottom {
header "redecl-merge-bottom.h"
export *
}
+module namespaces_top {
+ header "namespaces-top.h"
+ export *
+}
+module namespaces_left {
+ header "namespaces-left.h"
+ export *
+}
+module namespaces_right {
+ header "namespaces-right.h"
+ export *
+}
diff --git a/clang/test/Modules/Inputs/namespaces-left.h b/clang/test/Modules/Inputs/namespaces-left.h
new file mode 100644
index 00000000000..85e6d7dc607
--- /dev/null
+++ b/clang/test/Modules/Inputs/namespaces-left.h
@@ -0,0 +1,11 @@
+@import namespaces_top;
+
+namespace N1 { }
+
+namespace N1 {
+ float& f(float);
+}
+
+namespace N2 {
+ float& f(float);
+}
diff --git a/clang/test/Modules/Inputs/namespaces-right.h b/clang/test/Modules/Inputs/namespaces-right.h
new file mode 100644
index 00000000000..23c88bdbe9b
--- /dev/null
+++ b/clang/test/Modules/Inputs/namespaces-right.h
@@ -0,0 +1,18 @@
+@import namespaces_top;
+
+namespace N2 { }
+
+namespace N2 { }
+
+namespace N2 { }
+
+namespace N2 { }
+
+namespace N2 {
+ double& f(double);
+}
+
+namespace N3 {
+ double& f(double);
+}
+
diff --git a/clang/test/Modules/Inputs/namespaces-top.h b/clang/test/Modules/Inputs/namespaces-top.h
new file mode 100644
index 00000000000..a69f43f1833
--- /dev/null
+++ b/clang/test/Modules/Inputs/namespaces-top.h
@@ -0,0 +1,11 @@
+namespace N1 {
+ int& f(int);
+}
+
+namespace N2 {
+ int& f(int);
+}
+
+namespace N3 {
+ int& f(int);
+}
diff --git a/clang/test/Modules/namespaces.cpp b/clang/test/Modules/namespaces.cpp
new file mode 100644
index 00000000000..75557ba4c14
--- /dev/null
+++ b/clang/test/Modules/namespaces.cpp
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c++ -fmodules -fmodule-cache-path %t -I %S/Inputs %s -verify
+
+@import namespaces_left;
+@import namespaces_right;
+
+void test() {
+ int &ir1 = N1::f(1);
+ int &ir2 = N2::f(1);
+ int &ir3 = N3::f(1);
+ float &fr1 = N1::f(1.0f);
+ float &fr2 = N2::f(1.0f);
+ double &dr1 = N2::f(1.0);
+ double &dr2 = N3::f(1.0);
+}
OpenPOWER on IntegriCloud