Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:56

0001 //===- InstallAPI/FrontendRecords.h ------------------------------*- C++-*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_INSTALLAPI_FRONTENDRECORDS_H
0010 #define LLVM_CLANG_INSTALLAPI_FRONTENDRECORDS_H
0011 
0012 #include "clang/AST/Availability.h"
0013 #include "clang/AST/DeclObjC.h"
0014 #include "clang/InstallAPI/HeaderFile.h"
0015 #include "clang/InstallAPI/MachO.h"
0016 
0017 namespace clang {
0018 namespace installapi {
0019 
0020 /// Frontend information captured about records.
0021 struct FrontendAttrs {
0022   const AvailabilityInfo Avail;
0023   const Decl *D;
0024   const SourceLocation Loc;
0025   const HeaderType Access;
0026 };
0027 
0028 // Represents a collection of frontend records for a library that are tied to a
0029 // darwin target triple.
0030 class FrontendRecordsSlice : public llvm::MachO::RecordsSlice {
0031 public:
0032   FrontendRecordsSlice(const llvm::Triple &T)
0033       : llvm::MachO::RecordsSlice({T}) {}
0034 
0035   /// Add non-ObjC global record with attributes from AST.
0036   ///
0037   /// \param Name The name of symbol.
0038   /// \param Linkage The linkage of symbol.
0039   /// \param GV The kind of global.
0040   /// \param Avail The availability information tied to the active target
0041   /// triple.
0042   /// \param D The pointer to the declaration from traversing AST.
0043   /// \param Access The intended access level of symbol.
0044   /// \param Flags The flags that describe attributes of the symbol.
0045   /// \param Inlined Whether declaration is inlined, only applicable to
0046   /// functions.
0047   /// \return The non-owning pointer to added record in slice with it's frontend
0048   /// attributes.
0049   std::pair<GlobalRecord *, FrontendAttrs *>
0050   addGlobal(StringRef Name, RecordLinkage Linkage, GlobalRecord::Kind GV,
0051             const clang::AvailabilityInfo Avail, const Decl *D,
0052             const HeaderType Access, SymbolFlags Flags = SymbolFlags::None,
0053             bool Inlined = false);
0054 
0055   /// Add ObjC Class record with attributes from AST.
0056   ///
0057   /// \param Name The name of class, not symbol.
0058   /// \param Linkage The linkage of symbol.
0059   /// \param Avail The availability information tied to the active target
0060   /// triple.
0061   /// \param D The pointer to the declaration from traversing AST.
0062   /// \param Access The intended access level of symbol.
0063   /// \param IsEHType Whether declaration has an exception attribute.
0064   /// \return The non-owning pointer to added record in slice with it's frontend
0065   /// attributes.
0066   std::pair<ObjCInterfaceRecord *, FrontendAttrs *>
0067   addObjCInterface(StringRef Name, RecordLinkage Linkage,
0068                    const clang::AvailabilityInfo Avail, const Decl *D,
0069                    HeaderType Access, bool IsEHType);
0070 
0071   /// Add ObjC Category record with attributes from AST.
0072   ///
0073   /// \param ClassToExtend The name of class that is extended by category, not
0074   /// symbol.
0075   /// \param CategoryName The name of category, not symbol.
0076   /// \param Avail The availability information tied
0077   /// to the active target triple.
0078   /// \param D The pointer to the declaration from traversing AST.
0079   /// \param Access The intended access level of symbol.
0080   /// \return The non-owning pointer to added record in slice with it's frontend
0081   /// attributes.
0082   std::pair<ObjCCategoryRecord *, FrontendAttrs *>
0083   addObjCCategory(StringRef ClassToExtend, StringRef CategoryName,
0084                   const clang::AvailabilityInfo Avail, const Decl *D,
0085                   HeaderType Access);
0086 
0087   /// Add ObjC IVar record with attributes from AST.
0088   ///
0089   /// \param Container The owning pointer for instance variable.
0090   /// \param Name The name of ivar, not symbol.
0091   /// \param Linkage The linkage of symbol.
0092   /// \param Avail The availability information tied to the active target
0093   /// triple.
0094   /// \param D The pointer to the declaration from traversing AST.
0095   /// \param Access The intended access level of symbol.
0096   /// \param AC The access control tied to the ivar declaration.
0097   /// \return The non-owning pointer to added record in slice with it's frontend
0098   /// attributes.
0099   std::pair<ObjCIVarRecord *, FrontendAttrs *>
0100   addObjCIVar(ObjCContainerRecord *Container, StringRef IvarName,
0101               RecordLinkage Linkage, const clang::AvailabilityInfo Avail,
0102               const Decl *D, HeaderType Access,
0103               const clang::ObjCIvarDecl::AccessControl AC);
0104 
0105 private:
0106   /// Mapping of records stored in slice to their frontend attributes.
0107   llvm::DenseMap<Record *, FrontendAttrs> FrontendRecords;
0108 };
0109 
0110 } // namespace installapi
0111 } // namespace clang
0112 
0113 #endif // LLVM_CLANG_INSTALLAPI_FRONTENDRECORDS_H