clang 19.0.0git
Public Member Functions | List of all members
clang::api_notes::APINotesManager Class Reference

The API notes manager helps find API notes associated with declarations. More...

#include "clang/APINotes/APINotesManager.h"

Public Member Functions

 APINotesManager (SourceManager &SM, const LangOptions &LangOpts)
 
 ~APINotesManager ()
 
void setSwiftVersion (llvm::VersionTuple Version)
 Set the Swift version to use when filtering API notes.
 
bool loadCurrentModuleAPINotes (Module *M, bool LookInModule, ArrayRef< std::string > SearchPaths)
 Load the API notes for the current module.
 
llvm::SmallVector< FileEntryRef, 2 > getCurrentModuleAPINotes (Module *M, bool LookInModule, ArrayRef< std::string > SearchPaths)
 Get FileEntry for the APINotes of the module that is currently being compiled.
 
bool loadCurrentModuleAPINotesFromBuffer (ArrayRef< StringRef > Buffers)
 Load Compiled API notes for current module.
 
ArrayRef< APINotesReader * > getCurrentModuleReaders () const
 Retrieve the set of API notes readers for the current module.
 
llvm::SmallVector< APINotesReader *, 2 > findAPINotes (SourceLocation Loc)
 Find the API notes readers that correspond to the given source location.
 

Detailed Description

The API notes manager helps find API notes associated with declarations.

API notes are externally-provided annotations for declarations that can introduce new attributes (covering availability, nullability of parameters/results, and so on) for specific declarations without directly modifying the headers that contain those declarations.

The API notes manager is responsible for finding and loading the external API notes files that correspond to a given header. Its primary operation is findAPINotes(), which finds the API notes reader that provides information about the declarations at that location.

Definition at line 44 of file APINotesManager.h.

Constructor & Destructor Documentation

◆ APINotesManager()

APINotesManager::APINotesManager ( SourceManager SM,
const LangOptions LangOpts 
)

Definition at line 52 of file APINotesManager.cpp.

◆ ~APINotesManager()

APINotesManager::~APINotesManager ( )

Definition at line 55 of file APINotesManager.cpp.

Member Function Documentation

◆ findAPINotes()

llvm::SmallVector< APINotesReader *, 2 > APINotesManager::findAPINotes ( SourceLocation  Loc)

◆ getCurrentModuleAPINotes()

llvm::SmallVector< FileEntryRef, 2 > APINotesManager::getCurrentModuleAPINotes ( Module M,
bool  LookInModule,
ArrayRef< std::string >  SearchPaths 
)

Get FileEntry for the APINotes of the module that is currently being compiled.

Parameters
MThe current module.
LookInModuleWhether to look inside the directory of the current module.
SearchPathsThe paths in which we should search for API notes for the current module.
Returns
a vector of FileEntry where APINotes files are.

Definition at line 220 of file APINotesManager.cpp.

References checkPrivateAPINotesName(), clang::Module::Directory, clang::Module::ExportAsModule, clang::File, clang::SourceManager::getDiagnostics(), clang::SourceManager::getFileManager(), clang::DirectoryEntryRef::getName(), clang::FileManager::getOptionalDirectoryRef(), clang::Module::getTopLevelModule(), clang::Module::getTopLevelModuleName(), hasPrivateSubmodules(), clang::Module::IsFramework, and clang::Module::ModuleMapIsPrivate.

Referenced by loadCurrentModuleAPINotes().

◆ getCurrentModuleReaders()

ArrayRef< APINotesReader * > clang::api_notes::APINotesManager::getCurrentModuleReaders ( ) const
inline

Retrieve the set of API notes readers for the current module.

Definition at line 159 of file APINotesManager.h.

Referenced by findAPINotes(), and loadCurrentModuleAPINotes().

◆ loadCurrentModuleAPINotes()

bool APINotesManager::loadCurrentModuleAPINotes ( Module M,
bool  LookInModule,
ArrayRef< std::string >  SearchPaths 
)

Load the API notes for the current module.

Parameters
MThe current module.
LookInModuleWhether to look inside the module itself.
SearchPathsThe paths in which we should search for API notes for the current module.
Returns
true if API notes were successfully loaded, false otherwise.

Definition at line 302 of file APINotesManager.cpp.

References clang::Module::APINotesFile, clang::File, getCurrentModuleAPINotes(), and getCurrentModuleReaders().

◆ loadCurrentModuleAPINotesFromBuffer()

bool APINotesManager::loadCurrentModuleAPINotesFromBuffer ( ArrayRef< StringRef >  Buffers)

Load Compiled API notes for current module.

Parameters
BuffersArray of compiled API notes.
Returns
true if API notes were successfully loaded, false otherwise.

Definition at line 318 of file APINotesManager.cpp.

◆ setSwiftVersion()

void clang::api_notes::APINotesManager::setSwiftVersion ( llvm::VersionTuple  Version)
inline

Set the Swift version to use when filtering API notes.

Definition at line 122 of file APINotesManager.h.


The documentation for this class was generated from the following files: