Debian Codegraph @

llvm/tools/llvm-reduce/deltas/StripDebugInfo.cpp

raw
1 //===- StripDebugInfo.cpp -------------------------------------------------===//
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 "StripDebugInfo.h"
10 #include "llvm/IR/DebugInfo.h"
11 #include "llvm/IR/Metadata.h"
12
13 using namespace llvm;
14
15 /// Removes all aliases aren't inside any of the
16 /// desired Chunks.
17 void llvm::stripDebugInfoDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) {
18 Module &Program = WorkItem.getModule();
19 bool HasDebugInfo = any_of(Program.named_metadata(), [](NamedMDNode &NMD) {
20 return NMD.getName().starts_with("llvm.dbg.");
21 });
22 if (HasDebugInfo && !O.shouldKeep())
23 StripDebugInfo(Program);
24 }