comparison tools/dsymutil/SymbolMap.h @ 171:66f3bfe93da9

git version 2c4ca6832fa6b306ee6a7010bfb80a3f2596f824
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:07:02 +0900
parents c2174574ed3a
children
comparison
equal deleted inserted replaced
150:1d019706d866 171:66f3bfe93da9
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 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H
10 #define LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H
11
12 #include "llvm/ADT/StringRef.h"
13
14 #include <string>
15 #include <vector>
16
17 namespace llvm {
18 namespace dsymutil {
19 class DebugMap;
20
21 /// Callable class to unobfuscate strings based on a BCSymbolMap.
22 class SymbolMapTranslator {
23 public:
24 SymbolMapTranslator() : MangleNames(false) {}
25
26 SymbolMapTranslator(std::vector<std::string> UnobfuscatedStrings,
27 bool MangleNames)
28 : UnobfuscatedStrings(std::move(UnobfuscatedStrings)),
29 MangleNames(MangleNames) {}
30
31 StringRef operator()(StringRef Input);
32
33 operator bool() const { return !UnobfuscatedStrings.empty(); }
34
35 private:
36 std::vector<std::string> UnobfuscatedStrings;
37 bool MangleNames;
38 };
39
40 /// Class to initialize SymbolMapTranslators from a BCSymbolMap.
41 class SymbolMapLoader {
42 public:
43 SymbolMapLoader(std::string SymbolMap) : SymbolMap(std::move(SymbolMap)) {}
44
45 SymbolMapTranslator Load(StringRef InputFile, const DebugMap &Map) const;
46
47 private:
48 const std::string SymbolMap;
49 };
50 } // namespace dsymutil
51 } // namespace llvm
52
53 #endif // LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H