[yaml2obj/obj2yaml] - Add support for .stack_sizes sections.
[llvm-complete.git] / unittests / ADT / PostOrderIteratorTest.cpp
blob8e53247fc2f6f7403974bab514cecde01f8b4ecd
1 //===- PostOrderIteratorTest.cpp - PostOrderIterator unit tests -----------===//
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 #include "llvm/ADT/PostOrderIterator.h"
9 #include "llvm/IR/BasicBlock.h"
10 #include "llvm/IR/CFG.h"
11 #include "gtest/gtest.h"
12 using namespace llvm;
14 namespace {
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
21 void *Null = nullptr;
22 po_iterator_storage<std::set<void *>, false> PIS;
23 PIS.insertEdge(Optional<void *>(), Null);
24 ExtSetTy Ext;
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
29 // base)
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);