PageRenderTime 47ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/test/CodeGenCXX/virtual-destructor-calls.cpp

https://bitbucket.org/codefirex/external_clang
C++ | 59 lines | 20 code | 15 blank | 24 comment | 0 complexity | e00b953e8f0f688d6d866dd5fa8d37f0 MD5 | raw file
  1. // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -mconstructor-aliases | FileCheck %s
  2. struct Member {
  3. ~Member();
  4. };
  5. struct A {
  6. virtual ~A();
  7. };
  8. struct B : A {
  9. Member m;
  10. virtual ~B();
  11. };
  12. // Complete dtor: just an alias because there are no virtual bases.
  13. // CHECK: @_ZN1BD1Ev = alias {{.*}} @_ZN1BD2Ev
  14. // (aliases from C)
  15. // CHECK: @_ZN1CD1Ev = alias {{.*}} @_ZN1CD2Ev
  16. // CHECK: @_ZN1CD2Ev = alias bitcast {{.*}} @_ZN1BD2Ev
  17. // Deleting dtor: defers to the complete dtor.
  18. // CHECK: define void @_ZN1BD0Ev(%struct.B* %this) unnamed_addr
  19. // CHECK: call void @_ZN1BD1Ev
  20. // CHECK: call void @_ZdlPv
  21. // Base dtor: actually calls A's base dtor.
  22. // CHECK: define void @_ZN1BD2Ev(%struct.B* %this) unnamed_addr
  23. // CHECK: call void @_ZN6MemberD1Ev
  24. // CHECK: call void @_ZN1AD2Ev
  25. B::~B() { }
  26. struct C : B {
  27. ~C();
  28. };
  29. C::~C() { }
  30. // Complete dtor: just an alias (checked above).
  31. // Deleting dtor: defers to the complete dtor.
  32. // CHECK: define void @_ZN1CD0Ev(%struct.C* %this) unnamed_addr
  33. // CHECK: call void @_ZN1CD1Ev
  34. // CHECK: call void @_ZdlPv
  35. // Base dtor: just an alias to B's base dtor.
  36. namespace PR12798 {
  37. // A qualified call to a base class destructor should not undergo virtual
  38. // dispatch. Template instantiation used to lose the qualifier.
  39. struct A { virtual ~A(); };
  40. template<typename T> void f(T *p) { p->A::~A(); }
  41. // CHECK: define {{.*}} @_ZN7PR127981fINS_1AEEEvPT_(
  42. // CHECK: call void @_ZN7PR127981AD1Ev(
  43. template void f(A*);
  44. }