[flang] make HostIntrinsicProceduresLibrary a class
authorJean Perier <jperier@nvidia.com>
Fri, 22 Mar 2019 10:17:06 +0000 (03:17 -0700)
committerGitHub <noreply@github.com>
Wed, 27 Mar 2019 17:16:07 +0000 (10:16 -0700)
Original-commit: flang-compiler/f18@b9f5015d4df0d43a639fe58684291df5665ee585
Tree-same-pre-rewrite: false

flang/lib/evaluate/intrinsics-library-templates.h
flang/lib/evaluate/intrinsics-library.h

index 0f6364b..e163e9c 100644 (file)
@@ -121,7 +121,7 @@ std::optional<HostProcedureWrapper<ConstantContainer, TR, TA...>>
 HostIntrinsicProceduresLibrary::GetHostProcedureWrapper(
     const std::string &name) {
   if constexpr (host::HostTypeExists<TR, TA...>()) {
-    auto rteProcRange{procedures.equal_range(name)};
+    auto rteProcRange{procedures_.equal_range(name)};
     const TypeCode resTypeCode{typeCodeOf<TR>};
     const std::vector<TypeCode> argTypes{typeCodeOf<TA>...};
     const size_t nargs{argTypes.size()};
index 7575a0e..ebd4cd8 100644 (file)
@@ -90,20 +90,22 @@ using HostProcedureWrapper = std::function<ConstantContainer<TR>(
 // When queried for an intrinsic procedure, it can return a callable object that
 // implements this intrinsic if a host runtime function pointer for this
 // intrinsic was added to its data structure.
-struct HostIntrinsicProceduresLibrary {
+class HostIntrinsicProceduresLibrary {
+public:
+  HostIntrinsicProceduresLibrary();
   void AddProcedure(HostRuntimeIntrinsicProcedure &&sym) {
     const std::string name{sym.name};
-    procedures.insert(std::make_pair(name, std::move(sym)));
+    procedures_.insert(std::make_pair(name, std::move(sym)));
   }
   bool HasEquivalentProcedure(
       const IntrinsicProcedureRuntimeDescription &sym) const;
-  HostIntrinsicProceduresLibrary() { DefaultInit(); }
-  void DefaultInit();
   template<template<typename> typename ConstantContainer, typename TR,
       typename... TA>
   std::optional<HostProcedureWrapper<ConstantContainer, TR, TA...>>
   GetHostProcedureWrapper(const std::string &name);
-  std::multimap<std::string, const HostRuntimeIntrinsicProcedure> procedures;
+
+private:
+  std::multimap<std::string, const HostRuntimeIntrinsicProcedure> procedures_;
 };
 
 }