//===----------- JITSymbol.h - JIT symbol abstraction -----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Abstraction for target process addresses.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H
#define LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H

#include <functional>

namespace llvm {

/// @brief Represents an address in the target process's address space.
typedef uint64_t TargetAddress;

/// @brief Represents a symbol in the JIT.
class JITSymbol {
public:
  typedef std::function<TargetAddress()> GetAddressFtor;

  JITSymbol(std::nullptr_t) : CachedAddr(0) {}

  JITSymbol(GetAddressFtor GetAddress)
      : CachedAddr(0), GetAddress(std::move(GetAddress)) {}

  /// @brief Returns true if the symbol exists, false otherwise.
  explicit operator bool() const { return CachedAddr || GetAddress; }

  /// @brief Get the address of the symbol in the target address space. Returns
  ///        '0' if the symbol does not exist.
  TargetAddress getAddress() {
    if (GetAddress) {
      CachedAddr = GetAddress();
      assert(CachedAddr && "Symbol could not be materialized.");
      GetAddress = nullptr;
    }
    return CachedAddr;
  }

private:
  TargetAddress CachedAddr;
  GetAddressFtor GetAddress;
};

}

#endif // LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H

//===----------- JITSymbol.h - JIT symbol abstraction -----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Abstraction for target process addresses.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H
#define LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H

#include "llvm/Support/Compiler.h"
#include <functional>

namespace llvm {

/// @brief Represents an address in the target process's address space.
typedef uint64_t TargetAddress;

/// @brief Represents a symbol in the JIT.
class JITSymbol {
public:
  typedef std::function<TargetAddress()> GetAddressFtor;

  JITSymbol(std::nullptr_t) : CachedAddr(0) {}

  JITSymbol(GetAddressFtor GetAddress)
      : CachedAddr(0), GetAddress(std::move(GetAddress)) {}

  /// @brief Returns true if the symbol exists, false otherwise.
  LLVM_EXPLICIT operator bool() const { return CachedAddr || GetAddress; }

  /// @brief Get the address of the symbol in the target address space. Returns
  ///        '0' if the symbol does not exist.
  TargetAddress getAddress() {
    if (GetAddress) {
      CachedAddr = GetAddress();
      assert(CachedAddr && "Symbol could not be materialized.");
      GetAddress = nullptr;
    }
    return CachedAddr;
  }

private:
  TargetAddress CachedAddr;
  GetAddressFtor GetAddress;
};

}

#endif // LLVM_EXECUTIONENGINE_ORC_JITSYMBOL_H

Fix the MSVC bots by using LLVM_EXPLICIT rather than explicit.
[Orc] Fix the MSVC bots by using LLVM_EXPLICIT rather than explicit.


git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@228564 91177308-0d34-0410-b5e6-96231b3b80d8
