llvm/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp

//===- ValueMapper.cpp - Unit tests for ValueMapper -----------------------===//
//
// 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/Transforms/Utils/ValueMapper.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "gtest/gtest.h"

usingnamespacellvm;

namespace {

TEST(ValueMapperTest, mapMDNode) {}

TEST(ValueMapperTest, mapMDNodeCycle) {}

TEST(ValueMapperTest, mapMDNodeDuplicatedCycle) {}

TEST(ValueMapperTest, mapMDNodeUnresolved) {}

TEST(ValueMapperTest, mapMDNodeDistinct) {}

TEST(ValueMapperTest, mapMDNodeDistinctOperands) {}

TEST(ValueMapperTest, mapMDNodeSeeded) {}

TEST(ValueMapperTest, mapMDNodeSeededWithNull) {}

TEST(ValueMapperTest, mapMetadataNullMapGlobalWithIgnoreMissingLocals) {}

TEST(ValueMapperTest, mapMetadataMDString) {}

TEST(ValueMapperTest, mapMetadataGetMappedMD) {}

TEST(ValueMapperTest, mapMetadataNoModuleLevelChanges) {}

TEST(ValueMapperTest, mapMetadataConstantAsMetadata) {}

#ifdef GTEST_HAS_DEATH_TEST
#ifndef NDEBUG
TEST(ValueMapperTest, mapMetadataLocalAsMetadata) {
  LLVMContext C;
  FunctionType *FTy =
      FunctionType::get(Type::getVoidTy(C), Type::getInt8Ty(C), false);
  std::unique_ptr<Function> F(
      Function::Create(FTy, GlobalValue::ExternalLinkage, "F"));
  Argument &A = *F->arg_begin();

  // mapMetadata doesn't support LocalAsMetadata.  The only valid container for
  // LocalAsMetadata is a MetadataAsValue instance, so use it directly.
  auto *LAM = LocalAsMetadata::get(&A);
  ValueToValueMapTy VM;
  EXPECT_DEATH(ValueMapper(VM).mapMetadata(*LAM), "Unexpected local metadata");
  EXPECT_DEATH(ValueMapper(VM, RF_IgnoreMissingLocals).mapMetadata(*LAM),
               "Unexpected local metadata");
}
#endif
#endif

TEST(ValueMapperTest, mapValueLocalAsMetadata) {}

TEST(ValueMapperTest, mapValueLocalInArgList) {}

TEST(ValueMapperTest, mapValueLocalAsMetadataToConstant) {}

// Type remapper which remaps all types to same destination.
class TestTypeRemapper : public ValueMapTypeRemapper {};

TEST(ValueMapperTest, mapValuePoisonWithTypeRemap) {}

TEST(ValueMapperTest, mapValueConstantTargetNoneToLayoutTypeNullValue) {}

} // end namespace