mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
f8bd4c3bac
* Make the following private headers public:
* Lift/CPUStateAccessAnalysisPass.h
* Lift/CSVOffsets.h
* Lift/PTCDump.h
* Lift/VariableManager.h
* Move from revngSupport to revngLift:
* IRAnnotators.{h,cpp}
* SelfReferencingDbgAnnotationWriter.{h,cpp}
* Move from revngSupport to revngModel:
* FunctionTags.{h,cpp}
* ProgramCounterHandler.{h,cpp}
* Move from revngSupport to revngRecompile:
* OriginalAssemblyAnnotationWriter.{h,cpp}
33 lines
849 B
C++
33 lines
849 B
C++
/// \file RemoveDbgMetadata.cpp
|
|
/// A simple pass to remove debug metadata from a function.
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include "llvm/IR/Function.h"
|
|
#include "llvm/IR/Instructions.h"
|
|
#include "llvm/IR/Metadata.h"
|
|
|
|
#include "revng/BasicAnalyses/RemoveDbgMetadata.h"
|
|
#include "revng/Model/FunctionTags.h"
|
|
|
|
using namespace llvm;
|
|
|
|
char RemoveDbgMetadata::ID = 0;
|
|
|
|
using Register = RegisterPass<RemoveDbgMetadata>;
|
|
static Register X("remove-dbg-metadata", "Removes dbg metadata from Functions");
|
|
|
|
bool RemoveDbgMetadata::runOnFunction(llvm::Function &F) {
|
|
if (not FunctionTags::Isolated.isTagOf(&F))
|
|
return false;
|
|
|
|
F.setMetadata(LLVMContext::MD_dbg, nullptr);
|
|
for (BasicBlock &BB : F)
|
|
for (Instruction &I : BB)
|
|
I.setMetadata(LLVMContext::MD_dbg, nullptr);
|
|
|
|
return true;
|
|
}
|