if (!Use)
return;
*Use = MD;
- Use = nullptr;
+
+ if (*Use)
+ MetadataTracking::track(*Use);
+
+ Metadata *T = cast<Metadata>(this);
+ MetadataTracking::untrack(T);
+ assert(!Use && "Use is still being tracked despite being untracked!");
}
};
DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
static cl::opt<bool>
-ShowAnnotations("show-annotations",
- cl::desc("Add informational comments to the .ll file"));
+ SetImporting("set-importing",
+ cl::desc("Set lazy loading to pretend to import a module"),
+ cl::Hidden);
+
+static cl::opt<bool>
+ ShowAnnotations("show-annotations",
+ cl::desc("Add informational comments to the .ll file"));
static cl::opt<bool> PreserveAssemblyUseListOrder(
"preserve-ll-uselistorder",
static std::unique_ptr<Module> openInputFile(LLVMContext &Context) {
std::unique_ptr<MemoryBuffer> MB =
ExitOnErr(errorOrToExpected(MemoryBuffer::getFileOrSTDIN(InputFilename)));
- std::unique_ptr<Module> M =
- ExitOnErr(getOwningLazyBitcodeModule(std::move(MB), Context,
- /*ShouldLazyLoadMetadata=*/true));
+ std::unique_ptr<Module> M = ExitOnErr(getOwningLazyBitcodeModule(
+ std::move(MB), Context,
+ /*ShouldLazyLoadMetadata=*/true, SetImporting));
if (MaterializeMetadata)
ExitOnErr(M->materializeMetadata());
else