LCOV - code coverage report
Current view: top level - include/llvm/ExecutionEngine/Orc - LambdaResolver.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 9 9 100.0 %
Date: 2018-10-20 13:21:21 Functions: 3 7 42.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- LambdaResolverMM - Redirect symbol lookup via a functor --*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : //   Defines a RuntimeDyld::SymbolResolver subclass that uses a user-supplied
      11             : // functor for symbol resolution.
      12             : //
      13             : //===----------------------------------------------------------------------===//
      14             : 
      15             : #ifndef LLVM_EXECUTIONENGINE_ORC_LAMBDARESOLVER_H
      16             : #define LLVM_EXECUTIONENGINE_ORC_LAMBDARESOLVER_H
      17             : 
      18             : #include "llvm/ADT/STLExtras.h"
      19             : #include "llvm/ExecutionEngine/JITSymbol.h"
      20             : #include <memory>
      21             : 
      22             : namespace llvm {
      23             : namespace orc {
      24             : 
      25             : template <typename DylibLookupFtorT, typename ExternalLookupFtorT>
      26          32 : class LambdaResolver : public LegacyJITSymbolResolver {
      27             : public:
      28           8 :   LambdaResolver(DylibLookupFtorT DylibLookupFtor,
      29             :                  ExternalLookupFtorT ExternalLookupFtor)
      30             :       : DylibLookupFtor(DylibLookupFtor),
      31           8 :         ExternalLookupFtor(ExternalLookupFtor) {}
      32             : 
      33           4 :   JITSymbol findSymbolInLogicalDylib(const std::string &Name) final {
      34           4 :     return DylibLookupFtor(Name);
      35             :   }
      36             : 
      37          20 :   JITSymbol findSymbol(const std::string &Name) final {
      38          20 :     return ExternalLookupFtor(Name);
      39             :   }
      40             : 
      41             : private:
      42             :   DylibLookupFtorT DylibLookupFtor;
      43             :   ExternalLookupFtorT ExternalLookupFtor;
      44             : };
      45             : 
      46             : template <typename DylibLookupFtorT,
      47             :           typename ExternalLookupFtorT>
      48             : std::shared_ptr<LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>>
      49           8 : createLambdaResolver(DylibLookupFtorT DylibLookupFtor,
      50             :                      ExternalLookupFtorT ExternalLookupFtor) {
      51             :   using LR = LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>;
      52             :   return make_unique<LR>(std::move(DylibLookupFtor),
      53           8 :                          std::move(ExternalLookupFtor));
      54             : }
      55             : 
      56             : } // end namespace orc
      57             : } // end namespace llvm
      58             : 
      59             : #endif // LLVM_EXECUTIONENGINE_ORC_LAMBDARESOLVER_H

Generated by: LCOV version 1.13