diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-10-05 00:48:18 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-10-05 00:48:18 +0000 |
commit | b5085172fa3c7010ced43519ff23ce244f1e7607 (patch) | |
tree | 86891ffd26913928fe5295cf06d7738efae9b965 | |
parent | dbda370edbca549da400d99d15aea1e720e268ff (diff) |
Add testcase for r314956:
PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314957 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Modules/merge-lambdas.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Modules/merge-lambdas.cpp b/test/Modules/merge-lambdas.cpp new file mode 100644 index 0000000000..6f243ae54c --- /dev/null +++ b/test/Modules/merge-lambdas.cpp @@ -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(); +} |