LLVM 24.0.0git
PluginCAS.cpp File Reference

Implements ObjectStore and ActionCache on top of a dynamically loaded plugin that provides the C API in "llvm-c/CAS/PluginAPI_functions.h". More...

#include "PluginAPI.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/CAS/ActionCache.h"
#include "llvm/CAS/ObjectStore.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "PluginAPI_functions.def"

Go to the source code of this file.

Macros

#define CASPLUGINAPI_FUNCTION(name, required)

Functions

static Expected< llcas_cas_options_t > createPluginOptions (const llcas_functions_t &Functions, StringRef OnDiskPath, ArrayRef< std::pair< std::string, std::string > > PluginArgs)
 Creates a llcas_cas_options_t for OnDiskPath and PluginArgs.
static StringRef toStringRef (llcas_digest_t c_digest)
static Expected< ValidationResult > callPluginValidationFunction (StringRef PluginPath, StringRef OnDiskPath, ArrayRef< std::pair< std::string, std::string > > PluginArgs, function_ref< Expected< llcas_validation_result_t >(const llcas_functions_t &, llcas_cas_options_t, char **)> Fn)
 Loads the plugin and calls Fn with a llcas_cas_options_t for OnDiskPath and PluginArgs, converting the returned llcas_validation_result_t.

Detailed Description

Implements ObjectStore and ActionCache on top of a dynamically loaded plugin that provides the C API in "llvm-c/CAS/PluginAPI_functions.h".

The asynchronous entry points of the plugin API are not called yet; they will be wired up once ObjectStore and ActionCache grow asynchronous interfaces.

Definition in file PluginCAS.cpp.

Macro Definition Documentation

◆ CASPLUGINAPI_FUNCTION

#define CASPLUGINAPI_FUNCTION ( name,
required )
Value:
if (!(Functions.name = (decltype(llcas_functions_t::name)) \
Lib.getAddressOfSymbol("llcas_" #name))) { \
if (required) \
return reportError("failed symbol 'llcas_" #name "' lookup"); \
}
static Error reportError(StringRef Message)
static const char * name

Function Documentation

◆ callPluginValidationFunction()

◆ createPluginOptions()

Expected< llcas_cas_options_t > createPluginOptions ( const llcas_functions_t & Functions,
StringRef OnDiskPath,
ArrayRef< std::pair< std::string, std::string > > PluginArgs )
static

Creates a llcas_cas_options_t for OnDiskPath and PluginArgs.

On success the caller is responsible for disposing it.

Definition at line 105 of file PluginCAS.cpp.

References llvm::SmallString< InternalLen >::c_str(), LLCAS_VERSION_MAJOR, and LLCAS_VERSION_MINOR.

Referenced by callPluginValidationFunction().

◆ toStringRef()

StringRef toStringRef ( llcas_digest_t c_digest)
static