/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Transforms/Utils/StripNonLineTableDebugInfo.cpp
Line | Count | Source (jump to first uncovered line) |
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/Pass.h" |
11 | | #include "llvm/Transforms/Utils.h" |
12 | | using namespace llvm; |
13 | | |
14 | | namespace { |
15 | | |
16 | | /// This pass strips all debug info that is not related line tables. |
17 | | /// The result will be the same as if the program where compiled with |
18 | | /// -gline-tables-only. |
19 | | struct StripNonLineTableDebugInfo : public ModulePass { |
20 | | static char ID; // Pass identification, replacement for typeid |
21 | 5 | StripNonLineTableDebugInfo() : ModulePass(ID) { |
22 | 5 | initializeStripNonLineTableDebugInfoPass(*PassRegistry::getPassRegistry()); |
23 | 5 | } |
24 | | |
25 | 5 | void getAnalysisUsage(AnalysisUsage &AU) const override { |
26 | 5 | AU.setPreservesAll(); |
27 | 5 | } |
28 | | |
29 | 5 | bool runOnModule(Module &M) override { |
30 | 5 | return llvm::stripNonLineTableDebugInfo(M); |
31 | 5 | } |
32 | | }; |
33 | | } |
34 | | |
35 | | char StripNonLineTableDebugInfo::ID = 0; |
36 | | INITIALIZE_PASS(StripNonLineTableDebugInfo, "strip-nonlinetable-debuginfo", |
37 | | "Strip all debug info except linetables", false, false) |
38 | | |
39 | 0 | ModulePass *llvm::createStripNonLineTableDebugInfoPass() { |
40 | 0 | return new StripNonLineTableDebugInfo(); |
41 | 0 | } |