Files
swift-mirror/test/Interop/Cxx/class/Inputs/destructors-with-temporary-values.h
Egor Zhdan 93e7427ed2 [cxx-interop] Emit IR for destructors of temporary C++ values
This fixes the "undefined reference" linker errors.

rdar://101092732
2022-10-21 15:34:04 +01:00

26 lines
605 B
C

#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_DESTRUCTORS_WITH_TEMPORARY_VALUES_H
#define TEST_INTEROP_CXX_CLASS_INPUTS_DESTRUCTORS_WITH_TEMPORARY_VALUES_H
struct Value {
void referencedByDestructor() { r(); }
double r();
};
void referencedByDestructor(Value *ptr) { ptr->referencedByDestructor(); }
struct Reference {
~Reference() {
if (ptr)
referencedByDestructor(ptr);
}
Value *ptr;
};
inline Reference getRef();
inline void takeDouble(double);
inline void testFunction() { takeDouble(getRef().ptr->r()); }
#endif // TEST_INTEROP_CXX_CLASS_INPUTS_DESTRUCTORS_WITH_TEMPORARY_VALUES_H