summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-10-21 07:13:52 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-10-21 07:13:52 +0000
commit896c66ecc64e9f8fa80b08b8d9d7eecfce5c3acd (patch)
tree495d1a16c5c55d9c63c4a537b467fb9f7245213c /clang/test/Modules
parent4215236621357cb4b21dfbcfc6e87bc3c222e9f1 (diff)
downloadbcm5719-llvm-896c66ecc64e9f8fa80b08b8d9d7eecfce5c3acd.tar.gz
bcm5719-llvm-896c66ecc64e9f8fa80b08b8d9d7eecfce5c3acd.zip
[modules] libstdc++ defines some static inline functions in its internal
headers. If those headers end up being textually included twice into the same module, we get ambiguity errors. Work around this by downgrading the ambiguity error to a warning if multiple identical internal-linkage functions appear in an overload set, and just pick one of those functions as the lookup result. llvm-svn: 250884
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h4
-rw-r--r--clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/b.h4
-rw-r--r--clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/c.h4
-rw-r--r--clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h3
-rw-r--r--clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/module.modulemap6
-rw-r--r--clang/test/Modules/libstdcxx-ambiguous-internal.cpp7
6 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h
new file mode 100644
index 00000000000..e079bd0908e
--- /dev/null
+++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/a.h
@@ -0,0 +1,4 @@
+#ifndef A_H
+#define A_H
+static inline void f() {}
+#endif
diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/b.h b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/b.h
new file mode 100644
index 00000000000..c0a827870a9
--- /dev/null
+++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/b.h
@@ -0,0 +1,4 @@
+#ifndef B_H
+#define B_H
+#include "a.h"
+#endif
diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/c.h b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/c.h
new file mode 100644
index 00000000000..53122faf795
--- /dev/null
+++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/c.h
@@ -0,0 +1,4 @@
+#ifndef C_H
+#define C_H
+#include "a.h"
+#endif
diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h
new file mode 100644
index 00000000000..1627bfb99e2
--- /dev/null
+++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/d.h
@@ -0,0 +1,3 @@
+#include "b.h"
+#include "c.h"
+inline void g() { f(); }
diff --git a/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/module.modulemap b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/module.modulemap
new file mode 100644
index 00000000000..12d03880c6e
--- /dev/null
+++ b/clang/test/Modules/Inputs/libstdcxx-ambiguous-internal/module.modulemap
@@ -0,0 +1,6 @@
+module std {
+ module A { textual header "a.h" }
+ module B { header "b.h" }
+ module C { header "c.h" }
+ module D { header "d.h" export * }
+}
diff --git a/clang/test/Modules/libstdcxx-ambiguous-internal.cpp b/clang/test/Modules/libstdcxx-ambiguous-internal.cpp
new file mode 100644
index 00000000000..966b9c97681
--- /dev/null
+++ b/clang/test/Modules/libstdcxx-ambiguous-internal.cpp
@@ -0,0 +1,7 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -emit-module -fmodule-name=std -fmodules-cache-path=%t %S/Inputs/libstdcxx-ambiguous-internal/module.modulemap -Werror
+// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -emit-module -fmodule-name=std -fmodules-cache-path=%t %S/Inputs/libstdcxx-ambiguous-internal/module.modulemap -fmodules-local-submodule-visibility -DAMBIGUOUS 2>&1| FileCheck %s
+
+// CHECK-NOT: error
+// CHECK: warning: ambiguous use of internal linkage function 'f' defined in multiple modules
+// CHECK-NOT: error
OpenPOWER on IntegriCloud