llvm/llvm/unittests/ExecutionEngine/JITLink/EHFrameSupportTests.cpp

//===----- EHFrameSupportTests.cpp - Unit tests for eh-frame support ------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "llvm/ADT/STLExtras.h"
#include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h"
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/ExecutionEngine/JITLink/MachO_arm64.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"

usingnamespacellvm;
usingnamespacellvm::jitlink;

// TestObjectBytes contains a MachO arm64 object file with three symbols: foo,
// bar, and main, with corresponding FDEs. It was generated with:
//
// % cat foo.cpp
// extern "C" void e();
// extern "C" void a() {
//   try {
//     e();
//   } catch (int x) {
//   }
// }
// extern "C" void b() noexcept {}
// extern "C" void c() noexcept {}
//
// % clang++ --target=arm64-apple-darwin -femit-dwarf-unwind=always -c -o foo.o
// \
//   foo.c
// % xxd -i foo.o

static const uint8_t TestObjectBytes[] =;

llvm::MemoryBufferRef
    TestObject(StringRef(reinterpret_cast<const char *>(TestObjectBytes),
                         sizeof(TestObjectBytes)),
               "foo.o");

TEST(EHFrameCFIBlockInspector, BasicSuccessCase) {}

TEST(EHFrameCFIBlockInspector, ExternalPCBegin) {}