mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -51,3 +51,8 @@ void DiagnosticInfoStackSize::print(DiagnosticPrinter &DP) const {
|
||||
DP << "stack size limit exceeded (" << getStackSize() << ") in "
|
||||
<< getFunction();
|
||||
}
|
||||
|
||||
void DiagnosticInfoDebugMetadataVersion::print(DiagnosticPrinter &DP) const {
|
||||
DP << "invalid debug metadata version (" << getMetadataVersion() << ") in "
|
||||
<< getModule();
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/IR/DiagnosticPrinter.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Value.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
@@ -99,3 +100,8 @@ DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) {
|
||||
Stream << V.getName();
|
||||
return *this;
|
||||
}
|
||||
|
||||
DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Module &M) {
|
||||
Stream << M.getModuleIdentifier();
|
||||
return *this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user