mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
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:
@@ -16,6 +16,7 @@
|
||||
#include "llvm/Bitcode/LLVMBitCodes.h"
|
||||
#include "llvm/IR/AutoUpgrade.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DebugInfo.h"
|
||||
#include "llvm/IR/DebugInfoMetadata.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
#include "llvm/IR/DiagnosticPrinter.h"
|
||||
@@ -218,6 +219,8 @@ class BitcodeReader : public GVMaterializer {
|
||||
/// True if any Metadata block has been materialized.
|
||||
bool IsMetadataMaterialized;
|
||||
|
||||
bool StripDebugInfo = false;
|
||||
|
||||
public:
|
||||
std::error_code Error(BitcodeError E, const Twine &Message);
|
||||
std::error_code Error(BitcodeError E);
|
||||
@@ -255,6 +258,8 @@ public:
|
||||
/// Materialize any deferred Metadata block.
|
||||
std::error_code materializeMetadata() override;
|
||||
|
||||
void setStripDebugInfo() override;
|
||||
|
||||
private:
|
||||
std::vector<StructType *> IdentifiedStructTypes;
|
||||
StructType *createIdentifiedStructType(LLVMContext &Context, StringRef Name);
|
||||
@@ -2609,6 +2614,10 @@ std::error_code BitcodeReader::materializeMetadata() {
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
void BitcodeReader::setStripDebugInfo() {
|
||||
StripDebugInfo = true;
|
||||
}
|
||||
|
||||
/// RememberAndSkipFunctionBody - When we see the block for a function body,
|
||||
/// remember where it is and then skip it. This lets us lazily deserialize the
|
||||
/// functions.
|
||||
@@ -4305,6 +4314,9 @@ std::error_code BitcodeReader::materialize(GlobalValue *GV) {
|
||||
return EC;
|
||||
F->setIsMaterializable(false);
|
||||
|
||||
if (StripDebugInfo)
|
||||
stripDebugInfo(*F);
|
||||
|
||||
// Upgrade any old intrinsic calls in the function.
|
||||
for (UpgradedIntrinsicMap::iterator I = UpgradedIntrinsics.begin(),
|
||||
E = UpgradedIntrinsics.end(); I != E; ++I) {
|
||||
|
Reference in New Issue
Block a user