clang 20.0.0git
Classes | Typedefs | Enumerations | Functions
clang::installapi Namespace Reference

The DirectoryScanner for collecting library files on the file system. More...

Classes

class  DirectoryScanner
 
class  DylibVerifier
 Service responsible to tracking state of verification across the lifetime of InstallAPI. More...
 
class  FileListReader
 
struct  FrontendAttrs
 Frontend information captured about records. More...
 
class  FrontendRecordsSlice
 
class  HeaderFile
 
class  HeaderGlob
 Glob that represents a pattern of header files to retreive. More...
 
class  InstallAPIAction
 
struct  InstallAPIContext
 Struct used for generating validating InstallAPI. More...
 
class  InstallAPIVisitor
 ASTVisitor for collecting declarations that represent global symbols. More...
 
class  Library
 
struct  ZipperedDeclSource
 

Typedefs

using LibAttrs = llvm::StringMap< ArchitectureSet >
 
using ReexportedInterfaces = llvm::SmallVector< llvm::MachO::InterfaceFile, 8 >
 
using ZipperedDeclSources = std::vector< ZipperedDeclSource >
 
using HeaderSeq = std::vector< HeaderFile >
 

Enumerations

enum  ScanMode { ScanFrameworks , ScanDylibs }
 
enum class  VerificationMode { Invalid , ErrorsOnly , ErrorsAndWarnings , Pedantic }
 A list of InstallAPI verification modes. More...
 
enum class  HeaderType { Public , Private , Project , Unknown }
 

Functions

std::string findLibrary (StringRef InstallName, FileManager &FM, ArrayRef< std::string > FrameworkSearchPaths, ArrayRef< std::string > LibrarySearchPaths, ArrayRef< std::string > SearchPaths)
 Lookup the dylib or TextAPI file location for a system library or framework.
 
std::unique_ptr< llvm::MemoryBuffer > createInputBuffer (InstallAPIContext &Ctx)
 Create a buffer that contains all headers to scan for global symbols with.
 
StringRef getName (const HeaderType T)
 
std::optional< std::string > createIncludeHeaderName (const StringRef FullPath)
 Assemble expected way header will be included by clients.
 
bool isHeaderFile (StringRef Path)
 Determine if Path is a header file.
 
llvm::Expected< PathSeqenumerateFiles (clang::FileManager &FM, StringRef Directory)
 Given input directory, collect all header files.
 
static bool isFramework (StringRef Path)
 
static bool isCppMangled (StringRef Name)
 
static std::string demangle (StringRef Name)
 
static DylibVerifier::Result updateResult (const DylibVerifier::Result Prev, const DylibVerifier::Result Curr)
 
static bool shouldIgnorePrivateExternAttr (const Decl *D)
 
RecordfindRecordFromSlice (const RecordsSlice *Slice, StringRef Name, EncodeKind Kind)
 
static ObjCIFSymbolKind assignObjCIFSymbolKind (const ObjCInterfaceRecord *R)
 
static bool shouldIgnoreCpp (StringRef Name, bool IsWeakDef)
 
static StringRef getFileExtension (clang::Language Lang)
 
const Regex Rule ("(.+)/(.+)\\.framework/")
 
static bool isExported (const NamedDecl *D)
 
static bool isInlined (const FunctionDecl *D)
 
static SymbolFlags getFlags (bool WeakDef, bool ThreadLocal=false)
 
static bool hasObjCExceptionAttribute (const ObjCInterfaceDecl *D)
 Check if the interface itself or any of its super classes have an exception attribute.
 
static bool hasVTable (const CXXRecordDecl *D)
 
static CXXLinkage getVTableLinkage (const CXXRecordDecl *D)
 
static bool isRTTIWeakDef (const CXXRecordDecl *D)
 
static bool hasRTTI (const CXXRecordDecl *D)
 

Detailed Description

The DirectoryScanner for collecting library files on the file system.

Defines the content of a library, such as public and private header files, and whether it is a framework.

Representations of a library's headers for InstallAPI.

Typedef Documentation

◆ HeaderSeq

using clang::installapi::HeaderSeq = typedef std::vector<HeaderFile>

Definition at line 150 of file HeaderFile.h.

◆ LibAttrs

using clang::installapi::LibAttrs = typedef llvm::StringMap<ArchitectureSet>

Definition at line 28 of file DylibVerifier.h.

◆ ReexportedInterfaces

using clang::installapi::ReexportedInterfaces = typedef llvm::SmallVector<llvm::MachO::InterfaceFile, 8>

Definition at line 29 of file DylibVerifier.h.

◆ ZipperedDeclSources

Definition at line 39 of file DylibVerifier.h.

Enumeration Type Documentation

◆ HeaderType

enum class clang::installapi::HeaderType
strong
Enumerator
Public 

Represents declarations accessible to all clients.

Private 

Represents declarations accessible to a disclosed set of clients.

Project 

Represents declarations only accessible as implementation details to the input library.

Unknown 

Unset or unknown type.

Definition at line 26 of file HeaderFile.h.

◆ ScanMode

Enumerator
ScanFrameworks 

Scanning Framework directory.

ScanDylibs 

Scanning Dylib directory.

Definition at line 20 of file DirectoryScanner.h.

◆ VerificationMode

A list of InstallAPI verification modes.

Enumerator
Invalid 
ErrorsOnly 
ErrorsAndWarnings 
Pedantic 

Definition at line 21 of file DylibVerifier.h.

Function Documentation

◆ assignObjCIFSymbolKind()

static ObjCIFSymbolKind clang::installapi::assignObjCIFSymbolKind ( const ObjCInterfaceRecord R)
static

Definition at line 539 of file DylibVerifier.cpp.

References clang::Result.

Referenced by clang::installapi::DylibVerifier::verify().

◆ createIncludeHeaderName()

std::optional< std::string > clang::installapi::createIncludeHeaderName ( const StringRef  FullPath)

Assemble expected way header will be included by clients.

As in what maps inside the brackets of #include <IncludeName.h> For example, "/System/Library/Frameworks/Foo.framework/Headers/Foo.h" returns "Foo/Foo.h"

Parameters
FullPathPath to the header file which includes the library structure.

Definition at line 19 of file HeaderFile.cpp.

References clang::installapi::HeaderFile::getFrameworkIncludeRule().

◆ createInputBuffer()

std::unique_ptr< MemoryBuffer > clang::installapi::createInputBuffer ( InstallAPIContext Ctx)

◆ demangle()

static std::string clang::installapi::demangle ( StringRef  Name)
static

Definition at line 54 of file DylibVerifier.cpp.

References isCppMangled(), and clang::Result.

◆ enumerateFiles()

llvm::Expected< PathSeq > clang::installapi::enumerateFiles ( clang::FileManager FM,
StringRef  Directory 
)

Given input directory, collect all header files.

Parameters
FMFileManager for finding input files.
DirectoryPath to directory file.

Definition at line 45 of file HeaderFile.cpp.

References clang::FileManager::getVirtualFileSystem(), isHeaderFile(), and Path.

◆ findLibrary()

std::string clang::installapi::findLibrary ( StringRef  InstallName,
FileManager FM,
ArrayRef< std::string >  FrameworkSearchPaths,
ArrayRef< std::string >  LibrarySearchPaths,
ArrayRef< std::string >  SearchPaths 
)

Lookup the dylib or TextAPI file location for a system library or framework.

The search paths provided are searched in order. @rpath based libraries are not supported.

Parameters
InstallNameThe install name for the library.
FrameworkSearchPathsSearch paths to look up frameworks with.
LibrarySearchPathsSearch paths to look up dylibs with.
SearchPathsFallback search paths if library was not found in earlier paths.
Returns
The full path of the library.

Definition at line 166 of file Frontend.cpp.

References Filename, clang::FileManager::getOptionalFileRef(), and Path.

◆ findRecordFromSlice()

Record * clang::installapi::findRecordFromSlice ( const RecordsSlice Slice,
StringRef  Name,
EncodeKind  Kind 
)

Definition at line 151 of file DylibVerifier.cpp.

◆ getFileExtension()

static StringRef clang::installapi::getFileExtension ( clang::Language  Lang)
static

Definition at line 121 of file Frontend.cpp.

References clang::C, clang::CXX, clang::ObjC, and clang::ObjCXX.

Referenced by createInputBuffer().

◆ getFlags()

static SymbolFlags clang::installapi::getFlags ( bool  WeakDef,
bool  ThreadLocal = false 
)
static

◆ getName()

StringRef clang::installapi::getName ( const HeaderType  T)
inline

Definition at line 38 of file HeaderFile.h.

References Private, Project, Public, clang::T, and Unknown.

Referenced by createInputBuffer().

◆ getVTableLinkage()

static CXXLinkage clang::installapi::getVTableLinkage ( const CXXRecordDecl D)
static

◆ hasObjCExceptionAttribute()

static bool clang::installapi::hasObjCExceptionAttribute ( const ObjCInterfaceDecl D)
static

Check if the interface itself or any of its super classes have an exception attribute.

InstallAPI needs to export an additional symbol ("OBJC_EHTYPE_$CLASS_NAME") if any of the classes have the exception attribute.

Definition at line 133 of file Visitor.cpp.

References D.

Referenced by clang::installapi::InstallAPIVisitor::VisitObjCInterfaceDecl().

◆ hasRTTI()

static bool clang::installapi::hasRTTI ( const CXXRecordDecl D)
static

Definition at line 401 of file Visitor.cpp.

References D, and isRTTIWeakDef().

◆ hasVTable()

static bool clang::installapi::hasVTable ( const CXXRecordDecl D)
static

◆ isCppMangled()

static bool clang::installapi::isCppMangled ( StringRef  Name)
static

Definition at line 48 of file DylibVerifier.cpp.

Referenced by demangle().

◆ isExported()

static bool clang::installapi::isExported ( const NamedDecl D)
static

◆ isFramework()

static bool clang::installapi::isFramework ( StringRef  Path)
static

Definition at line 66 of file DirectoryScanner.cpp.

References Path.

◆ isHeaderFile()

bool clang::installapi::isHeaderFile ( StringRef  Path)

Determine if Path is a header file.

It does not touch the file system.

Parameters
PathFile path to file.

Definition at line 39 of file HeaderFile.cpp.

References Path.

Referenced by enumerateFiles().

◆ isInlined()

static bool clang::installapi::isInlined ( const FunctionDecl D)
static

◆ isRTTIWeakDef()

static bool clang::installapi::isRTTIWeakDef ( const CXXRecordDecl D)
static

Definition at line 388 of file Visitor.cpp.

References D, and getVTableLinkage().

Referenced by hasRTTI().

◆ Rule()

const Regex clang::installapi::Rule ( "(.+)/(.+)\\.framework/"  )

◆ shouldIgnoreCpp()

static bool clang::installapi::shouldIgnoreCpp ( StringRef  Name,
bool  IsWeakDef 
)
static

Definition at line 601 of file DylibVerifier.cpp.

◆ shouldIgnorePrivateExternAttr()

static bool clang::installapi::shouldIgnorePrivateExternAttr ( const Decl D)
static

Definition at line 142 of file DylibVerifier.cpp.

References D, and clang::SC_PrivateExtern.

◆ updateResult()

static DylibVerifier::Result clang::installapi::updateResult ( const DylibVerifier::Result  Prev,
const DylibVerifier::Result  Curr 
)
static