1f4a2713aSLionel Sambuc // RUN: rm -rf %t 2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -verify -std=c++11 3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -x objective-c++ -fmodules -fmodules-cache-path=%t -I %S/Inputs %s -ast-dump -ast-dump-filter merge -std=c++11 | FileCheck %s 4f4a2713aSLionel Sambuc 5f4a2713aSLionel Sambuc // expected-no-diagnostics 6f4a2713aSLionel Sambuc use_implicit_new()7*0a6a1f1dSLionel Sambucvoid use_implicit_new() { operator new[](3); } 8*0a6a1f1dSLionel Sambuc 9f4a2713aSLionel Sambuc @import dummy; 10f4a2713aSLionel Sambuc @import cxx_decls.imported; 11f4a2713aSLionel Sambuc test_delete(int * p)12f4a2713aSLionel Sambucvoid test_delete(int *p) { 13f4a2713aSLionel Sambuc // We can call the normal global deallocation function even though it has only 14f4a2713aSLionel Sambuc // ever been explicitly declared in an unimported submodule. 15f4a2713aSLionel Sambuc delete p; 16f4a2713aSLionel Sambuc } 17f4a2713aSLionel Sambuc friend_1(HasFriends s)18f4a2713aSLionel Sambucvoid friend_1(HasFriends s) { 19f4a2713aSLionel Sambuc s.private_thing(); 20f4a2713aSLionel Sambuc } test_friends(HasFriends s)21f4a2713aSLionel Sambucvoid test_friends(HasFriends s) { 22f4a2713aSLionel Sambuc friend_1(s); 23f4a2713aSLionel Sambuc friend_2(s); 24f4a2713aSLionel Sambuc } 25*0a6a1f1dSLionel Sambuc 26*0a6a1f1dSLionel Sambuc static_assert(!__is_trivial(HasNontrivialDefaultConstructor), ""); 27*0a6a1f1dSLionel Sambuc static_assert(!__has_trivial_constructor(HasNontrivialDefaultConstructor), ""); 28*0a6a1f1dSLionel Sambuc use_implicit_new_again()29*0a6a1f1dSLionel Sambucvoid use_implicit_new_again() { operator new[](3); } 30*0a6a1f1dSLionel Sambuc 31*0a6a1f1dSLionel Sambuc int importMergeUsedFlag = getMergeUsedFlag(); 32*0a6a1f1dSLionel Sambuc use_name_for_linkage(NameForLinkage & nfl)33*0a6a1f1dSLionel Sambucint use_name_for_linkage(NameForLinkage &nfl) { 34*0a6a1f1dSLionel Sambuc return nfl.n + nfl.m; 35*0a6a1f1dSLionel Sambuc } use_overrides_virtual_functions(OverridesVirtualFunctions ovf)36*0a6a1f1dSLionel Sambucint use_overrides_virtual_functions(OverridesVirtualFunctions ovf) { return 0; } 37*0a6a1f1dSLionel Sambuc 38*0a6a1f1dSLionel Sambuc @import cxx_decls_merged; 39*0a6a1f1dSLionel Sambuc 40*0a6a1f1dSLionel Sambuc NameForLinkage2Inner use_name_for_linkage2_inner; 41*0a6a1f1dSLionel Sambuc NameForLinkage2 use_name_for_linkage2; 42*0a6a1f1dSLionel Sambuc 43*0a6a1f1dSLionel Sambuc int name_for_linkage_test = use_name_for_linkage(name_for_linkage); 44*0a6a1f1dSLionel Sambuc int overrides_virtual_functions_test = 45*0a6a1f1dSLionel Sambuc use_overrides_virtual_functions(overrides_virtual_functions); 46*0a6a1f1dSLionel Sambuc use_extern_c_function()47*0a6a1f1dSLionel Sambucvoid use_extern_c_function() { ExternCFunction(); } 48*0a6a1f1dSLionel Sambuc use_namespace_alias()49*0a6a1f1dSLionel Sambucint use_namespace_alias() { return Alias::a + Alias::b; } 50*0a6a1f1dSLionel Sambuc 51*0a6a1f1dSLionel Sambuc @import cxx_decls_premerged; 52*0a6a1f1dSLionel Sambuc use_extern_c_function_2()53*0a6a1f1dSLionel Sambucvoid use_extern_c_function_2() { ExternCFunction(); } 54*0a6a1f1dSLionel Sambuc 55*0a6a1f1dSLionel Sambuc // CHECK: VarDecl [[mergeUsedFlag:0x[0-9a-f]*]] {{.*}} in cxx_decls.imported used mergeUsedFlag 56*0a6a1f1dSLionel Sambuc // CHECK: VarDecl {{0x[0-9a-f]*}} prev [[mergeUsedFlag]] {{.*}} in cxx_decls_merged used mergeUsedFlag 57