IR: de-duplicate two CmpInst routines (NFC) (#116866)
[llvm-project.git] / llvm / unittests / ExecutionEngine / Orc / ObjectFormatsTest.cpp
blobb1ff1f2fbc3f8ee7dc46570acc5b10240a6a1f33
1 //===-------- ObjectLinkingLayerTest.cpp - ObjectLinkingLayer 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 //===----------------------------------------------------------------------===//
9 #include "llvm/ExecutionEngine/Orc/Shared/ObjectFormats.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
13 using namespace llvm::orc;
15 namespace {
17 TEST(ObjectFormatsTest, MachOInitializerSections) {
18 EXPECT_TRUE(isMachOInitializerSection("__DATA,__objc_selrefs"));
19 EXPECT_TRUE(isMachOInitializerSection("__DATA,__mod_init_func"));
20 EXPECT_TRUE(isMachOInitializerSection("__DATA,__objc_classlist"));
21 EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_proto"));
22 EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_protos"));
23 EXPECT_TRUE(isMachOInitializerSection("__TEXT,__swift5_types"));
24 EXPECT_FALSE(isMachOInitializerSection("__DATA,__not_an_init_sec"));
27 TEST(ObjectFormatsTest, ELFInitializerSections) {
28 EXPECT_TRUE(isELFInitializerSection(".init_array"));
29 EXPECT_TRUE(isELFInitializerSection(".init_array.0"));
30 EXPECT_FALSE(isELFInitializerSection(".text"));
31 EXPECT_TRUE(isELFInitializerSection(".ctors.0"));
34 } // end anonymous namespace