llvm/llvm/unittests/IR/FunctionTest.cpp

//===- FunctionTest.cpp - Function unit tests -----------------------------===//
//
// 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/IR/Function.h"
#include "llvm-c/Core.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/SourceMgr.h"
#include "gtest/gtest.h"
usingnamespacellvm;

namespace {

static std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) {}

static BasicBlock *getBBWithName(Function *F, StringRef Name) {}

TEST(FunctionTest, hasLazyArguments) {}

TEST(FunctionTest, stealArgumentListFrom) {}

// Test setting and removing section information
TEST(FunctionTest, setSection) {}

TEST(FunctionTest, GetPointerAlignment) {}

TEST(FunctionTest, InsertBasicBlockAt) {}

TEST(FunctionTest, SpliceOneBB) {}

TEST(FunctionTest, SpliceOneBBWhenFromIsSameAsTo) {}

TEST(FunctionTest, SpliceLastBB) {}

TEST(FunctionTest, SpliceBBRange) {}

#ifdef EXPENSIVE_CHECKS
TEST(FunctionTest, SpliceEndBeforeBegin) {
  LLVMContext Ctx;
  std::unique_ptr<Module> M = parseIR(Ctx, R"(
    define void @from() {
     from_bb1:
       br label %from_bb2
     from_bb2:
       br label %from_bb3
     from_bb3:
       ret void
    }
    define void @to() {
     to_bb1:
       br label %to_bb2
     to_bb2:
       br label %to_bb3
     to_bb3:
       ret void
    }
)");

  Function *FromF = M->getFunction("from");
  BasicBlock *FromBB1 = getBBWithName(FromF, "from_bb1");
  BasicBlock *FromBB2 = getBBWithName(FromF, "from_bb2");

  Function *ToF = M->getFunction("to");
  BasicBlock *ToBB2 = getBBWithName(ToF, "to_bb2");

  EXPECT_DEATH(ToF->splice(ToBB2->getIterator(), FromF, FromBB2->getIterator(),
                           FromBB1->getIterator()),
               "FromBeginIt not before FromEndIt!");
}
#endif //EXPENSIVE_CHECKS

TEST(FunctionTest, EraseBBs) {}

TEST(FunctionTest, BasicBlockNumbers) {}

TEST(FunctionTest, UWTable) {}

TEST(FunctionTest, Personality) {}

} // end namespace