Fixed/added namespace ending comments using clang-tidy. NFC
[oota-llvm.git] / include / llvm / MC / MCExternalSymbolizer.h
1 //===-- llvm/MC/MCExternalSymbolizer.h - ------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the MCExternalSymbolizer class, which
11 // enables library users to provide callbacks (through the C API) to do the
12 // symbolization externally.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_MC_MCEXTERNALSYMBOLIZER_H
17 #define LLVM_MC_MCEXTERNALSYMBOLIZER_H
18
19 #include "llvm-c/Disassembler.h"
20 #include "llvm/MC/MCSymbolizer.h"
21 #include <memory>
22
23 namespace llvm {
24
25 /// \brief Symbolize using user-provided, C API, callbacks.
26 ///
27 /// See llvm-c/Disassembler.h.
28 class MCExternalSymbolizer : public MCSymbolizer {
29 protected:
30   /// \name Hooks for symbolic disassembly via the public 'C' interface.
31   /// @{
32   /// The function to get the symbolic information for operands.
33   LLVMOpInfoCallback GetOpInfo;
34   /// The function to lookup a symbol name.
35   LLVMSymbolLookupCallback SymbolLookUp;
36   /// The pointer to the block of symbolic information for above call back.
37   void *DisInfo;
38   /// @}
39
40 public:
41   MCExternalSymbolizer(MCContext &Ctx,
42                        std::unique_ptr<MCRelocationInfo> RelInfo,
43                        LLVMOpInfoCallback getOpInfo,
44                        LLVMSymbolLookupCallback symbolLookUp, void *disInfo)
45     : MCSymbolizer(Ctx, std::move(RelInfo)), GetOpInfo(getOpInfo),
46       SymbolLookUp(symbolLookUp), DisInfo(disInfo) {}
47
48   bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &CommentStream,
49                                 int64_t Value, uint64_t Address, bool IsBranch,
50                                 uint64_t Offset, uint64_t InstSize) override;
51   void tryAddingPcLoadReferenceComment(raw_ostream &CommentStream,
52                                        int64_t Value,
53                                        uint64_t Address) override;
54 };
55
56 } // namespace llvm
57
58 #endif