[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / tools / llvm-reduce / deltas / ReduceModuleData.cpp
blob7a59950ca907c044c5d56ccdb0b54b7ce895e9d7
1 //===- ReduceModuleData.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 // This file implements a reduce pass to reduce various module data.
11 //===----------------------------------------------------------------------===//
13 #include "ReduceModuleData.h"
15 using namespace llvm;
17 static void clearModuleData(Oracle &O, Module &Program) {
18 if (!Program.getModuleIdentifier().empty() && !O.shouldKeep())
19 Program.setModuleIdentifier("");
20 if (!Program.getSourceFileName().empty() && !O.shouldKeep())
21 Program.setSourceFileName("");
22 if (!Program.getDataLayoutStr().empty() && !O.shouldKeep())
23 Program.setDataLayout("");
24 if (!Program.getTargetTriple().empty() && !O.shouldKeep())
25 Program.setTargetTriple("");
26 // TODO: clear line by line rather than all at once
27 if (!Program.getModuleInlineAsm().empty() && !O.shouldKeep())
28 Program.setModuleInlineAsm("");
31 void llvm::reduceModuleDataDeltaPass(TestRunner &Test) {
32 outs() << "*** Reducing Module Data...\n";
33 runDeltaPass(Test, clearModuleData);