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