declare_reachable.pass.cpp 688 B

123456789101112131415161718192021222324252627
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // <memory>
  9. // void declare_reachable(void* p);
  10. // template <class T> T* undeclare_reachable(T* p);
  11. #include <memory>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. int main(int, char**)
  15. {
  16. int* p = new int;
  17. std::declare_reachable(p);
  18. assert(std::undeclare_reachable(p) == p);
  19. delete p;
  20. return 0;
  21. }