[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / llvm / tools / dsymutil / SymbolMap.h
blob977de31a5a17ace277ff4a51784cdc3049d23e3e
1 //=- tools/dsymutil/SymbolMap.h -----------------------------------*- C++ -*-=//
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 #ifndef LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H
10 #define LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H
12 #include "llvm/ADT/StringRef.h"
14 #include <string>
15 #include <vector>
17 namespace llvm {
18 namespace dsymutil {
19 class DebugMap;
21 /// Callable class to unobfuscate strings based on a BCSymbolMap.
22 class SymbolMapTranslator {
23 public:
24 SymbolMapTranslator() : MangleNames(false) {}
26 SymbolMapTranslator(std::vector<std::string> UnobfuscatedStrings,
27 bool MangleNames)
28 : UnobfuscatedStrings(std::move(UnobfuscatedStrings)),
29 MangleNames(MangleNames) {}
31 StringRef operator()(StringRef Input);
33 operator bool() const { return !UnobfuscatedStrings.empty(); }
35 private:
36 std::vector<std::string> UnobfuscatedStrings;
37 bool MangleNames;
40 /// Class to initialize SymbolMapTranslators from a BCSymbolMap.
41 class SymbolMapLoader {
42 public:
43 SymbolMapLoader(std::string SymbolMap) : SymbolMap(std::move(SymbolMap)) {}
45 SymbolMapTranslator Load(StringRef InputFile, const DebugMap &Map) const;
47 private:
48 const std::string SymbolMap;
50 } // namespace dsymutil
51 } // namespace llvm
53 #endif // LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H