StripNonLineTableDebugInfo.cpp [plain text]
#include "llvm/Transforms/IPO.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/Pass.h"
using namespace llvm;
namespace {
struct StripNonLineTableDebugInfo : public ModulePass {
static char ID; StripNonLineTableDebugInfo() : ModulePass(ID) {
initializeStripNonLineTableDebugInfoPass(*PassRegistry::getPassRegistry());
}
void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.setPreservesAll();
}
bool runOnModule(Module &M) override {
return llvm::convertDebugInfoToLineTables(M);
}
};
}
char StripNonLineTableDebugInfo::ID = 0;
INITIALIZE_PASS(StripNonLineTableDebugInfo, "strip-nonlinetable-debuginfo",
"Strip all debug info except linetables", false, false)
ModulePass *llvm::createStripNonLineTableDebugInfoPass() {
return new StripNonLineTableDebugInfo();
}