--- /dev/null
+; RUN: llvm-link %p/Inputs/drop-debug.bc -o %t 2>&1 | FileCheck %s
+
+;; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and
+; -gline-tables-only, so it contains old debug info.
+
+; CHECK: warning: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/CommandFlags.h"
-#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
Module &M = Obj.getModule();
- M.materializeMetadata();
- UpgradeDebugInfo(M);
+ // 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.
+ M.materializeAllPermanently();
SmallPtrSet<GlobalValue *, 8> Used;
collectUsedGlobalVariables(M, Used, /*CompilerUsed*/ false);
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();
+
return Result;
}