PostOrderIteratorTest.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //===- PostOrderIteratorTest.cpp - PostOrderIterator unit tests -----------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #include "gtest/gtest.h"
  10. #include "llvm/ADT/PostOrderIterator.h"
  11. #include "llvm/IR/BasicBlock.h"
  12. #include "llvm/IR/CFG.h"
  13. using namespace llvm;
  14. // //
  15. ///////////////////////////////////////////////////////////////////////////////
  16. namespace {
  17. // Whether we're able to compile
  18. TEST(PostOrderIteratorTest, Compiles) {
  19. typedef SmallPtrSet<void *, 4> ExtSetTy;
  20. // Tests that template specializations are kept up to date
  21. void *Null = nullptr;
  22. po_iterator_storage<std::set<void *>, false> PIS;
  23. PIS.insertEdge(Null, Null);
  24. ExtSetTy Ext;
  25. po_iterator_storage<ExtSetTy, true> PISExt(Ext);
  26. PIS.insertEdge(Null, Null);
  27. // Test above, but going through po_iterator (which inherits from template
  28. // base)
  29. BasicBlock *NullBB = nullptr;
  30. auto PI = po_end(NullBB);
  31. PI.insertEdge(NullBB, NullBB);
  32. auto PIExt = po_ext_end(NullBB, Ext);
  33. PIExt.insertEdge(NullBB, NullBB);
  34. }
  35. }