|
26 | 26 | // FIXME: This include is just for llvm::SanitizerCoverageOptions. We should
|
27 | 27 | // split the header upstream so we don't include so much.
|
28 | 28 | #include "llvm/Transforms/Instrumentation.h"
|
| 29 | +#include "llvm/Support/raw_ostream.h" |
29 | 30 | #include "llvm/Support/VersionTuple.h"
|
30 | 31 | #include <string>
|
31 | 32 | #include <vector>
|
@@ -253,15 +254,18 @@ class IRGenOptions {
|
253 | 254 | SanitizeCoverage(llvm::SanitizerCoverageOptions()),
|
254 | 255 | TypeInfoFilter(TypeInfoDumpFilter::All) {}
|
255 | 256 |
|
256 |
| - // Get a hash of all options which influence the llvm compilation but are not |
257 |
| - // reflected in the llvm module itself. |
258 |
| - unsigned getLLVMCodeGenOptionsHash() { |
259 |
| - unsigned Hash = (unsigned)OptMode; |
260 |
| - Hash = (Hash << 1) | DisableLLVMOptzns; |
261 |
| - Hash = (Hash << 1) | DisableSwiftSpecificLLVMOptzns; |
262 |
| - Hash = (Hash << 1) | GenerateProfile; |
263 |
| - Hash = (Hash << 1) | Sanitizers.contains(SanitizerKind::Fuzzer); |
264 |
| - return Hash; |
| 257 | + /// Appends to \p os an arbitrary string representing all options which |
| 258 | + /// influence the llvm compilation but are not reflected in the llvm module |
| 259 | + /// itself. |
| 260 | + void writeLLVMCodeGenOptionsTo(llvm::raw_ostream &os) { |
| 261 | + // We put a letter between each value simply to keep them from running into |
| 262 | + // one another. There might be a vague correspondence between meaning and |
| 263 | + // letter, but don't sweat it. |
| 264 | + os << 'O' << (unsigned)OptMode |
| 265 | + << 'd' << DisableLLVMOptzns |
| 266 | + << 'D' << DisableSwiftSpecificLLVMOptzns |
| 267 | + << 'p' << GenerateProfile |
| 268 | + << 's' << Sanitizers.contains(SanitizerKind::Fuzzer); |
265 | 269 | }
|
266 | 270 |
|
267 | 271 | /// Should LLVM IR value names be emitted and preserved?
|
|
0 commit comments