LLVM 17.0.0git
Go to the documentation of this file.
1//===- StripNonLineTableDebugInfo.cpp -- Strip parts of Debug Info --------===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10#include "llvm/IR/DebugInfo.h"
12#include "llvm/Pass.h"
14using namespace llvm;
16namespace {
18/// This pass strips all debug info that is not related line tables.
19/// The result will be the same as if the program where compiled with
20/// -gline-tables-only.
21struct StripNonLineTableDebugLegacyPass : public ModulePass {
22 static char ID; // Pass identification, replacement for typeid
23 StripNonLineTableDebugLegacyPass() : ModulePass(ID) {
26 }
28 void getAnalysisUsage(AnalysisUsage &AU) const override {
29 AU.setPreservesAll();
30 }
32 bool runOnModule(Module &M) override {
34 }
38char StripNonLineTableDebugLegacyPass::ID = 0;
40 "strip-nonlinetable-debuginfo",
41 "Strip all debug info except linetables", false, false)
44 return new StripNonLineTableDebugLegacyPass();
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:38
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:620
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:248
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Definition: Pass.cpp:98
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:158
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
ModulePass * createStripNonLineTableDebugLegacyPass()
This function returns a new pass that downgrades the debug info in the module to line tables only.
bool stripNonLineTableDebugInfo(Module &M)
Downgrade the debug info in a module to contain only line table information.
Definition: DebugInfo.cpp:792
void initializeStripNonLineTableDebugLegacyPassPass(PassRegistry &)