1*cb14a3feSDimitry Andric //===- llvm/TextAPI/RecordSlice.h - TAPI RecordSlice ------------*- C++ -*-===//
2*cb14a3feSDimitry Andric //
3*cb14a3feSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*cb14a3feSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*cb14a3feSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*cb14a3feSDimitry Andric //
7*cb14a3feSDimitry Andric //===----------------------------------------------------------------------===//
8*cb14a3feSDimitry Andric ///
9*cb14a3feSDimitry Andric /// Defines the TAPI Record Visitor.
10*cb14a3feSDimitry Andric ///
11*cb14a3feSDimitry Andric //===----------------------------------------------------------------------===//
12*cb14a3feSDimitry Andric 
13*cb14a3feSDimitry Andric #ifndef LLVM_TEXTAPI_RECORDVISITOR_H
14*cb14a3feSDimitry Andric #define LLVM_TEXTAPI_RECORDVISITOR_H
15*cb14a3feSDimitry Andric 
16*cb14a3feSDimitry Andric #include "llvm/TextAPI/Record.h"
17*cb14a3feSDimitry Andric #include "llvm/TextAPI/SymbolSet.h"
18*cb14a3feSDimitry Andric 
19*cb14a3feSDimitry Andric namespace llvm {
20*cb14a3feSDimitry Andric namespace MachO {
21*cb14a3feSDimitry Andric 
22*cb14a3feSDimitry Andric /// Base class for any usage of traversing over collected Records.
23*cb14a3feSDimitry Andric class RecordVisitor {
24*cb14a3feSDimitry Andric public:
25*cb14a3feSDimitry Andric   virtual ~RecordVisitor();
26*cb14a3feSDimitry Andric 
27*cb14a3feSDimitry Andric   virtual void visitGlobal(const GlobalRecord &) = 0;
28*cb14a3feSDimitry Andric   virtual void visitObjCInterface(const ObjCInterfaceRecord &);
29*cb14a3feSDimitry Andric   virtual void visitObjCCategory(const ObjCCategoryRecord &);
30*cb14a3feSDimitry Andric };
31*cb14a3feSDimitry Andric 
32*cb14a3feSDimitry Andric /// Specialized RecordVisitor for collecting exported symbols
33*cb14a3feSDimitry Andric /// and undefined symbols if RecordSlice being visited represents a
34*cb14a3feSDimitry Andric /// flat-namespaced library.
35*cb14a3feSDimitry Andric class SymbolConverter : public RecordVisitor {
36*cb14a3feSDimitry Andric public:
37*cb14a3feSDimitry Andric   SymbolConverter(SymbolSet *Symbols, const Target &T,
38*cb14a3feSDimitry Andric                   const bool RecordUndefs = false)
Symbols(Symbols)39*cb14a3feSDimitry Andric       : Symbols(Symbols), Targ(T), RecordUndefs(RecordUndefs) {}
40*cb14a3feSDimitry Andric   void visitGlobal(const GlobalRecord &) override;
41*cb14a3feSDimitry Andric   void visitObjCInterface(const ObjCInterfaceRecord &) override;
42*cb14a3feSDimitry Andric   void visitObjCCategory(const ObjCCategoryRecord &) override;
43*cb14a3feSDimitry Andric 
44*cb14a3feSDimitry Andric private:
45*cb14a3feSDimitry Andric   void addIVars(const ArrayRef<ObjCIVarRecord *>, StringRef ContainerName);
46*cb14a3feSDimitry Andric   SymbolSet *Symbols;
47*cb14a3feSDimitry Andric   const Target Targ;
48*cb14a3feSDimitry Andric   const bool RecordUndefs;
49*cb14a3feSDimitry Andric };
50*cb14a3feSDimitry Andric 
51*cb14a3feSDimitry Andric } // end namespace MachO.
52*cb14a3feSDimitry Andric } // end namespace llvm.
53*cb14a3feSDimitry Andric 
54*cb14a3feSDimitry Andric #endif // LLVM_TEXTAPI_RECORDVISITOR_H
55