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