From b9e46e3ebc349f1d2b454a61ccedec4955dbb67f Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Fri, 29 Aug 2014 22:33:38 +0000 Subject: [PATCH] Add some missing test coverage for merging 'extern "C"' functions with modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216796 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Modules/Inputs/cxx-decls-imported.h | 1 + test/Modules/Inputs/cxx-decls-merged.h | 1 + test/Modules/Inputs/cxx-decls-premerged.h | 3 +++ test/Modules/Inputs/module.map | 4 ++++ test/Modules/cxx-decls.cpp | 6 ++++++ 5 files changed, 15 insertions(+) create mode 100644 test/Modules/Inputs/cxx-decls-premerged.h diff --git a/test/Modules/Inputs/cxx-decls-imported.h b/test/Modules/Inputs/cxx-decls-imported.h index ccf1cb2b35..7677511103 100644 --- a/test/Modules/Inputs/cxx-decls-imported.h +++ b/test/Modules/Inputs/cxx-decls-imported.h @@ -35,3 +35,4 @@ struct HasVirtualFunctions { struct OverridesVirtualFunctions : HasVirtualFunctions { void f(); }; +extern "C" void ExternCFunction(); diff --git a/test/Modules/Inputs/cxx-decls-merged.h b/test/Modules/Inputs/cxx-decls-merged.h index 3f9da1a55e..8ba2df63ca 100644 --- a/test/Modules/Inputs/cxx-decls-merged.h +++ b/test/Modules/Inputs/cxx-decls-merged.h @@ -13,3 +13,4 @@ struct OverridesVirtualFunctions : HasVirtualFunctions { void f(); }; extern OverridesVirtualFunctions overrides_virtual_functions; +extern "C" void ExternCFunction(); diff --git a/test/Modules/Inputs/cxx-decls-premerged.h b/test/Modules/Inputs/cxx-decls-premerged.h new file mode 100644 index 0000000000..064fb9ea67 --- /dev/null +++ b/test/Modules/Inputs/cxx-decls-premerged.h @@ -0,0 +1,3 @@ +extern "C" void ExternCFunction(); + +#include "cxx-decls-imported.h" diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 72a65cf871..e8011c7055 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -246,6 +246,10 @@ module cxx_decls { } } +module cxx_decls_premerged { + header "cxx-decls-premerged.h" +} + module cxx_decls_merged { header "cxx-decls-merged.h" } diff --git a/test/Modules/cxx-decls.cpp b/test/Modules/cxx-decls.cpp index ee196cfc33..77982e46fb 100644 --- a/test/Modules/cxx-decls.cpp +++ b/test/Modules/cxx-decls.cpp @@ -41,5 +41,11 @@ int name_for_linkage_test = use_name_for_linkage(name_for_linkage); int overrides_virtual_functions_test = use_overrides_virtual_functions(overrides_virtual_functions); +void use_extern_c_function() { ExternCFunction(); } + +@import cxx_decls_premerged; + +void use_extern_c_function_2() { ExternCFunction(); } + // CHECK: VarDecl [[mergeUsedFlag:0x[0-9a-f]*]] {{.*}} in cxx_decls.imported used mergeUsedFlag // CHECK: VarDecl {{0x[0-9a-f]*}} prev [[mergeUsedFlag]] {{.*}} in cxx_decls_merged used mergeUsedFlag -- 2.40.0