LLVM  10.0.0
StripNonLineTableDebugInfo.cpp
Go to the documentation of this file.
1 //===- StripNonLineTableDebugInfo.cpp -- Strip parts of Debug Info --------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "llvm/IR/DebugInfo.h"
10 #include "llvm/InitializePasses.h"
11 #include "llvm/Pass.h"
12 #include "llvm/Transforms/Utils.h"
13 using namespace llvm;
14 
15 namespace {
16 
17 /// This pass strips all debug info that is not related line tables.
18 /// The result will be the same as if the program where compiled with
19 /// -gline-tables-only.
20 struct StripNonLineTableDebugInfo : public ModulePass {
21  static char ID; // Pass identification, replacement for typeid
22  StripNonLineTableDebugInfo() : ModulePass(ID) {
24  }
25 
26  void getAnalysisUsage(AnalysisUsage &AU) const override {
27  AU.setPreservesAll();
28  }
29 
30  bool runOnModule(Module &M) override {
32  }
33 };
34 }
35 
37 INITIALIZE_PASS(StripNonLineTableDebugInfo, "strip-nonlinetable-debuginfo",
38  "Strip all debug info except linetables", false, false)
39 
41  return new StripNonLineTableDebugInfo();
42 }
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:66
ModulePass * createStripNonLineTableDebugInfoPass()
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:589
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
INITIALIZE_PASS(StripNonLineTableDebugInfo, "strip-nonlinetable-debuginfo", "Strip all debug info except linetables", false, false) ModulePass *llvm
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:222
void initializeStripNonLineTableDebugInfoPass(PassRegistry &)