Fix PR23045.

Keep a note in the materializer that we are stripping debug info so that
user doing a lazy read of the module don't hit outdated formats.

Thanks to Duncan for suggesting the fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233603 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-03-30 21:36:43 +00:00
parent 7f3757eb9b
commit a55ae077e4
6 changed files with 39 additions and 20 deletions

View File

@ -15,6 +15,7 @@
#include "llvm/Linker/Linker.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/LLVMContext.h"
@ -69,11 +70,8 @@ loadFile(const char *argv0, const std::string &FN, LLVMContext &Context) {
if (!Result)
Err.print(argv0, errs());
// Fixme (pr23045). We would like to upgrade the metadata with something like
// Result->materializeMetadata();
// UpgradeDebugInfo(*Result);
// but that fails to drop old debug info from function bodies.
Result->materializeAllPermanently();
Result->materializeMetadata();
UpgradeDebugInfo(*Result);
return Result;
}