#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();
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) { … }
class TestTypeRemapper : public ValueMapTypeRemapper { … };
TEST(ValueMapperTest, mapValuePoisonWithTypeRemap) { … }
TEST(ValueMapperTest, mapValueConstantTargetNoneToLayoutTypeNullValue) { … }
}