Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===- InstallAPI/Library.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 /// Defines the content of a library, such as public and private
0010 /// header files, and whether it is a framework.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 #ifndef LLVM_CLANG_INSTALLAPI_LIBRARY_H
0014 #define LLVM_CLANG_INSTALLAPI_LIBRARY_H
0015 
0016 #include "clang/InstallAPI/HeaderFile.h"
0017 #include "clang/InstallAPI/MachO.h"
0018 
0019 namespace clang::installapi {
0020 
0021 class Library {
0022 public:
0023   Library(StringRef Directory) : BaseDirectory(Directory) {}
0024 
0025   /// Capture the name of the framework by the install name.
0026   ///
0027   /// \param InstallName The install name of the library encoded in a dynamic
0028   /// library.
0029   static StringRef getFrameworkNameFromInstallName(StringRef InstallName);
0030 
0031   /// Get name of library by the discovered file path.
0032   StringRef getName() const;
0033 
0034   /// Get discovered path of library.
0035   StringRef getPath() const { return BaseDirectory; }
0036 
0037   /// Add a header file that belongs to the library.
0038   ///
0039   /// \param FullPath Path to header file.
0040   /// \param Type Access level of header.
0041   /// \param IncludePath The way the header should be included.
0042   void addHeaderFile(StringRef FullPath, HeaderType Type,
0043                      StringRef IncludePath = StringRef()) {
0044     Headers.emplace_back(FullPath, Type, IncludePath);
0045   }
0046 
0047   /// Determine if library is empty.
0048   bool empty() {
0049     return SubFrameworks.empty() && Headers.empty() &&
0050            FrameworkVersions.empty();
0051   }
0052 
0053 private:
0054   std::string BaseDirectory;
0055   HeaderSeq Headers;
0056   std::vector<Library> SubFrameworks;
0057   std::vector<Library> FrameworkVersions;
0058   bool IsUnwrappedDylib{false};
0059 
0060   friend class DirectoryScanner;
0061 };
0062 
0063 } // namespace clang::installapi
0064 
0065 #endif // LLVM_CLANG_INSTALLAPI_LIBRARY_H