r314957 - Add testcase for r314956:

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 17:48:18 PDT 2017


Author: rsmith
Date: Wed Oct  4 17:48:18 2017
New Revision: 314957

URL: http://llvm.org/viewvc/llvm-project?rev=314957&view=rev
Log:
Add testcase for r314956:

PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.

Added:
    cfe/trunk/test/Modules/merge-lambdas.cpp

Added: cfe/trunk/test/Modules/merge-lambdas.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/merge-lambdas.cpp?rev=314957&view=auto
==============================================================================
--- cfe/trunk/test/Modules/merge-lambdas.cpp (added)
+++ cfe/trunk/test/Modules/merge-lambdas.cpp Wed Oct  4 17:48:18 2017
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -std=c++11 -emit-llvm-only -fmodules %s
+
+// PR33924: ensure that we merge together local lambas in multiple definitions
+// of the same function.
+
+#pragma clang module build format
+module format {}
+#pragma clang module contents
+#pragma clang module begin format
+struct A { template<typename T> void doFormat(T &&out) {} };
+template<typename T> void format(T t) { A().doFormat([]{}); }
+#pragma clang module end
+#pragma clang module endbuild
+
+#pragma clang module build foo1
+module foo1 { export * }
+#pragma clang module contents
+#pragma clang module begin foo1
+#pragma clang module import format
+inline void foo1() {
+  format(0);
+}
+#pragma clang module end
+#pragma clang module endbuild
+
+#pragma clang module build foo2
+module foo2 { export * }
+#pragma clang module contents
+#pragma clang module begin foo2
+#pragma clang module import format
+inline void foo2() {
+  format(0);
+}
+#pragma clang module end
+#pragma clang module endbuild
+
+#pragma clang module import foo1
+#pragma clang module import foo2
+
+int main() {
+  foo1();
+  foo2();
+}




More information about the cfe-commits mailing list