LCOV - code coverage report
Current view: top level - lib/ExecutionEngine/Orc - Legacy.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 22 22 100.0 %
Date: 2018-07-13 00:08:38 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===------- Legacy.cpp - Adapters for ExecutionEngine API interop --------===//
       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             : #include "llvm/ExecutionEngine/Orc/Legacy.h"
      11             : 
      12             : namespace llvm {
      13             : namespace orc {
      14             : 
      15         126 : JITSymbolResolverAdapter::JITSymbolResolverAdapter(
      16         126 :     ExecutionSession &ES, SymbolResolver &R, MaterializationResponsibility *MR)
      17         252 :     : ES(ES), R(R), MR(MR) {}
      18             : 
      19             : Expected<JITSymbolResolverAdapter::LookupResult>
      20          52 : JITSymbolResolverAdapter::lookup(const LookupSet &Symbols) {
      21             :   SymbolNameSet InternedSymbols;
      22         139 :   for (auto &S : Symbols)
      23         261 :     InternedSymbols.insert(ES.getSymbolStringPool().intern(S));
      24             : 
      25             :   auto LookupFn = [&, this](std::shared_ptr<AsynchronousSymbolQuery> Q,
      26          52 :                             SymbolNameSet Unresolved) {
      27          52 :     return R.lookup(std::move(Q), std::move(Unresolved));
      28         156 :   };
      29             : 
      30          52 :   auto InternedResult = blockingLookup(ES, std::move(LookupFn),
      31         260 :                                        std::move(InternedSymbols), false, MR);
      32             : 
      33          52 :   if (!InternedResult)
      34             :     return InternedResult.takeError();
      35             : 
      36             :   JITSymbolResolver::LookupResult Result;
      37         139 :   for (auto &KV : *InternedResult)
      38          87 :     Result[*KV.first] = KV.second;
      39             : 
      40             :   return Result;
      41             : }
      42             : 
      43             : Expected<JITSymbolResolverAdapter::LookupFlagsResult>
      44         126 : JITSymbolResolverAdapter::lookupFlags(const LookupSet &Symbols) {
      45             :   SymbolNameSet InternedSymbols;
      46         148 :   for (auto &S : Symbols)
      47          66 :     InternedSymbols.insert(ES.getSymbolStringPool().intern(S));
      48             : 
      49             :   SymbolFlagsMap SymbolFlags;
      50         252 :   R.lookupFlags(SymbolFlags, InternedSymbols);
      51             :   LookupFlagsResult Result;
      52         132 :   for (auto &KV : SymbolFlags) {
      53           6 :     ResolvedStrings.insert(KV.first);
      54           6 :     Result[*KV.first] = KV.second;
      55             :   }
      56             : 
      57         126 :   return Result;
      58             : }
      59             : 
      60             : } // End namespace orc.
      61             : } // End namespace llvm.

Generated by: LCOV version 1.13