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