summaryrefslogtreecommitdiff
path: root/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-01-16 01:51:12 +0000
committerManman Ren <manman.ren@gmail.com>2014-01-16 01:51:12 +0000
commit2666b15908125479cea95066593873168127be72 (patch)
tree8d18e91c3cba8e0add24b9b49b01c00919cc2324 /lib/IR/AutoUpgrade.cpp
parent897473a28dc52e941923ea22939f69dacb85a547 (diff)
downloadllvm-2666b15908125479cea95066593873168127be72.tar.gz
llvm-2666b15908125479cea95066593873168127be72.tar.bz2
llvm-2666b15908125479cea95066593873168127be72.tar.xz
Report a warning when dropping outdated debug info metadata.
Use DiagnosticInfo to emit the warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/AutoUpgrade.cpp')
-rw-r--r--lib/IR/AutoUpgrade.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/IR/AutoUpgrade.cpp b/lib/IR/AutoUpgrade.cpp
index d12bf7b9e3..4340c057c1 100644
--- a/lib/IR/AutoUpgrade.cpp
+++ b/lib/IR/AutoUpgrade.cpp
@@ -14,6 +14,7 @@
#include "llvm/AutoUpgrade.h"
#include "llvm/DebugInfo.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
@@ -494,8 +495,14 @@ Value *llvm::UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy) {
/// Check the debug info version number, if it is out-dated, drop the debug
/// info. Return true if module is modified.
bool llvm::UpgradeDebugInfo(Module &M) {
- if (getDebugMetadataVersionFromModule(M) == DEBUG_METADATA_VERSION)
+ unsigned Version = getDebugMetadataVersionFromModule(M);
+ if (Version == DEBUG_METADATA_VERSION)
return false;
- return StripDebugInfo(M);
+ bool RetCode = StripDebugInfo(M);
+ if (RetCode) {
+ DiagnosticInfoDebugMetadataVersion DiagVersion(M, Version);
+ M.getContext().diagnose(DiagVersion);
+ }
+ return RetCode;
}