llvm::CloneModule

CloneModule overloads

Synopses

Declared in <llvm/Transforms/Utils/Cloning.h>

Return an exact copy of the specified module.

std::unique_ptr<Module>
CloneModule(Module const& M);
» more...

Return a copy of the specified module, recording mappings in VMap.

std::unique_ptr<Module>
CloneModule(
    Module const& M,
    ValueToValueMapTy& VMap);
» more...

Return a copy of the specified module with selective definition cloning.

std::unique_ptr<Module>
CloneModule(
    Module const& M,
    ValueToValueMapTy& VMap,
    function_ref<bool(GlobalValue const*)> ShouldCloneDefinition);
» more...

Return Value

  • A new module that is an exact copy of M.
  • A new module that is a copy of M.
  • A new module whose definitions are filtered by ShouldCloneDefinition.

Parameters

NameDescription
MModule to clone.
VMapMapping from original values to their clones; filled by this call.
ShouldCloneDefinitionPredicate that returns true when a global's definition should be cloned rather than left as an external declaration.