[COFF] Don't mark mingw .eh_frame sections writable
[llvm-core.git] / unittests / ADT / IListSentinelTest.cpp
blobbd60c909de78f957045a6afad86886372d550b1f
1 //===- unittests/ADT/IListSentinelTest.cpp - ilist_sentinel 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 //===----------------------------------------------------------------------===//
10 #include "llvm/ADT/ilist_node.h"
11 #include "gtest/gtest.h"
13 using namespace llvm;
15 namespace {
17 template <class T, class... Options> struct PickSentinel {
18 typedef ilist_sentinel<
19 typename ilist_detail::compute_node_options<T, Options...>::type>
20 type;
23 class Node : public ilist_node<Node> {};
24 class TrackingNode : public ilist_node<Node, ilist_sentinel_tracking<true>> {};
25 typedef PickSentinel<Node>::type Sentinel;
26 typedef PickSentinel<Node, ilist_sentinel_tracking<true>>::type
27 TrackingSentinel;
28 typedef PickSentinel<Node, ilist_sentinel_tracking<false>>::type
29 NoTrackingSentinel;
31 struct LocalAccess : ilist_detail::NodeAccess {
32 using NodeAccess::getPrev;
33 using NodeAccess::getNext;
36 TEST(IListSentinelTest, DefaultConstructor) {
37 Sentinel S;
38 EXPECT_EQ(&S, LocalAccess::getPrev(S));
39 EXPECT_EQ(&S, LocalAccess::getNext(S));
40 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
41 EXPECT_TRUE(S.isKnownSentinel());
42 #else
43 EXPECT_FALSE(S.isKnownSentinel());
44 #endif
46 TrackingSentinel TS;
47 NoTrackingSentinel NTS;
48 EXPECT_TRUE(TS.isSentinel());
49 EXPECT_TRUE(TS.isKnownSentinel());
50 EXPECT_FALSE(NTS.isKnownSentinel());
53 TEST(IListSentinelTest, NormalNodeIsNotKnownSentinel) {
54 Node N;
55 EXPECT_EQ(nullptr, LocalAccess::getPrev(N));
56 EXPECT_EQ(nullptr, LocalAccess::getNext(N));
57 EXPECT_FALSE(N.isKnownSentinel());
59 TrackingNode TN;
60 EXPECT_FALSE(TN.isSentinel());
63 } // end namespace