Home | History | Annotate | Download | only in P_ref_count
      1 // RUN: %Slang %s
      2 // RUN: %rs-filecheck-wrapper %s
      3 
      4 #pragma version(1)
      5 #pragma rs java_package_name(ref_count)
      6 
      7 struct Wrapper {
      8   rs_element e;
      9   rs_type t;
     10 };
     11 
     12 
     13 // CHECK: call void @_Z13rsClearObjectP10rs_element(%struct.rs_element{{.*}}* nonnull %.rs.tmp{{[0-9]+}})
     14 // CHECK: call void @_Z11rsSetObjectP10rs_elementS_(%struct.rs_element{{.*}}* nonnull %.rs.retval{{[0-9]+}}, {{.*}})
     15 
     16 static rs_element bar() {
     17   rs_element x = {0};
     18   return x;
     19 }
     20 
     21 // CHECK: call void @_Z11rsSetObjectP10rs_elementS_(%struct.rs_element{{.*}}* %{{.*}}, {{.*}})
     22 // CHECK: call void @_Z11rsSetObjectP7rs_typeS_(%struct.rs_type{{.*}}* %{{.*}}, {{.*}})
     23 // CHECK: call void @_Z13rsClearObjectP10rs_element(%struct.rs_element{{.*}}* {{.*}})
     24 // CHECK: call void @_Z13rsClearObjectP7rs_type(%struct.rs_type{{.*}}* {{.*}})
     25 
     26 static struct Wrapper baz() {
     27   struct Wrapper x = { 0, 0 };
     28   return x;
     29 }
     30 
     31 void entrypoint() {
     32   rs_element e = bar();
     33   struct Wrapper w = baz();
     34   if (rsIsObject(e) && rsIsObject(w.e) && rsIsObject(w.t)) {
     35     rsDebug("good objects", 0);
     36   }
     37 }
     38