1 //=- tools/dsymutil/SymbolMap.h -----------------------------------*- C++ -*-=//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H
10 #define LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H
12 #include "llvm/ADT/StringRef.h"
21 /// Callable class to unobfuscate strings based on a BCSymbolMap.
22 class SymbolMapTranslator
{
24 SymbolMapTranslator() : MangleNames(false) {}
26 SymbolMapTranslator(std::vector
<std::string
> UnobfuscatedStrings
,
28 : UnobfuscatedStrings(std::move(UnobfuscatedStrings
)),
29 MangleNames(MangleNames
) {}
31 StringRef
operator()(StringRef Input
);
33 operator bool() const { return !UnobfuscatedStrings
.empty(); }
36 std::vector
<std::string
> UnobfuscatedStrings
;
40 /// Class to initialize SymbolMapTranslators from a BCSymbolMap.
41 class SymbolMapLoader
{
43 SymbolMapLoader(std::string SymbolMap
) : SymbolMap(std::move(SymbolMap
)) {}
45 SymbolMapTranslator
Load(StringRef InputFile
, const DebugMap
&Map
) const;
48 const std::string SymbolMap
;
50 } // namespace dsymutil
53 #endif // LLVM_TOOLS_DSYMUTIL_SYMBOLMAP_H