1 //===- PostOrderIteratorTest.cpp - PostOrderIterator unit tests -----------===//
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
7 //===----------------------------------------------------------------------===//
8 #include "llvm/ADT/PostOrderIterator.h"
9 #include "llvm/IR/BasicBlock.h"
10 #include "llvm/IR/CFG.h"
11 #include "gtest/gtest.h"
16 // Whether we're able to compile
17 TEST(PostOrderIteratorTest
, Compiles
) {
18 typedef SmallPtrSet
<void *, 4> ExtSetTy
;
20 // Tests that template specializations are kept up to date
22 po_iterator_storage
<std::set
<void *>, false> PIS
;
23 PIS
.insertEdge(Optional
<void *>(), Null
);
25 po_iterator_storage
<ExtSetTy
, true> PISExt(Ext
);
26 PIS
.insertEdge(Optional
<void *>(), Null
);
28 // Test above, but going through po_iterator (which inherits from template
30 BasicBlock
*NullBB
= nullptr;
31 auto PI
= po_end(NullBB
);
32 PI
.insertEdge(Optional
<BasicBlock
*>(), NullBB
);
33 auto PIExt
= po_ext_end(NullBB
, Ext
);
34 PIExt
.insertEdge(Optional
<BasicBlock
*>(), NullBB
);