Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / llvm / lib / Transforms / Utils / StripNonLineTableDebugInfo.cpp
blob21cbbfb140b6dd6f17777e5fc9929fb0ac078946
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 //===----------------------------------------------------------------------===//
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;
15 namespace {
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) {
23 initializeStripNonLineTableDebugInfoPass(*PassRegistry::getPassRegistry());
26 void getAnalysisUsage(AnalysisUsage &AU) const override {
27 AU.setPreservesAll();
30 bool runOnModule(Module &M) override {
31 return llvm::stripNonLineTableDebugInfo(M);
36 char StripNonLineTableDebugInfo::ID = 0;
37 INITIALIZE_PASS(StripNonLineTableDebugInfo, "strip-nonlinetable-debuginfo",
38 "Strip all debug info except linetables", false, false)
40 ModulePass *llvm::createStripNonLineTableDebugInfoPass() {
41 return new StripNonLineTableDebugInfo();