aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/CloneModule.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2013-01-11 15:29:34 -0800
committerDerek Schuff <dschuff@chromium.org>2013-01-11 15:29:34 -0800
commit0590f4264010a852dc22c9afa16a7df4d004c19a (patch)
tree018cedac9a062788c2fdc337165bbabc946b8d29 /lib/Transforms/Utils/CloneModule.cpp
parentb770d0e0636a4b5ad61b1ca661caee67576c05fc (diff)
Replace DepLibs bitcode record with metadata
It keeps the same Module interface as the existing/old deplibs feature, but populates the library list from the metadata after reading the bitcode/LL into the Module. Keeping the same module interface will allow us to keep the existing uses (e.g. in the gold plugin) as they are. Internally it still uses the LibraryList variable, but uses it basically as a cache backed by the metadata. BUG= Review URL: https://codereview.chromium.org/11615013
Diffstat (limited to 'lib/Transforms/Utils/CloneModule.cpp')
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index 114babd101..29ab5a72c4 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -37,7 +37,11 @@ Module *llvm::CloneModule(const Module *M, ValueToValueMapTy &VMap) {
New->setDataLayout(M->getDataLayout());
New->setTargetTriple(M->getTargetTriple());
New->setModuleInlineAsm(M->getModuleInlineAsm());
-
+ // @LOCALMOD-BEGIN
+ // Copy all of the dependent libraries over.
+ for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I)
+ New->addLibrary(*I);
+ // @LOCALMOD-END
// Loop over all of the global variables, making corresponding globals in the
// new module. Here we add them to the VMap and to the new Module. We
// don't worry about attributes or initializers, they will come later.