[llvm] r305760 - [ExecutionEngine] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

Eugene Zelenko via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 16:37:52 PDT 2017


Author: eugenezelenko
Date: Mon Jun 19 18:37:52 2017
New Revision: 305760

URL: http://llvm.org/viewvc/llvm-project?rev=305760&view=rev
Log:
[ExecutionEngine] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
    llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h
    llvm/trunk/include/llvm/ExecutionEngine/JITEventListener.h
    llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/GlobalMappingLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/LambdaResolver.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcABISupport.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
    llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
    llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
    llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
    llvm/trunk/tools/lli/OrcLazyJIT.cpp
    llvm/trunk/tools/lli/OrcLazyJIT.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Mon Jun 19 18:37:52 2017
@@ -15,54 +15,58 @@
 #ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
 #define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
 
-#include "RuntimeDyld.h"
 #include "llvm-c/ExecutionEngine.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
+#include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Module.h"
-#include "llvm/IR/ValueHandle.h"
-#include "llvm/IR/ValueMap.h"
 #include "llvm/Object/Binary.h"
+#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/CodeGen.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
+#include <algorithm>
+#include <cstdint>
 #include <functional>
 #include <map>
+#include <memory>
 #include <string>
 #include <vector>
 
 namespace llvm {
 
-struct GenericValue;
 class Constant;
-class DataLayout;
-class ExecutionEngine;
 class Function;
-class GlobalVariable;
+struct GenericValue;
 class GlobalValue;
+class GlobalVariable;
 class JITEventListener;
-class MachineCodeInfo;
 class MCJITMemoryManager;
-class MutexGuard;
 class ObjectCache;
 class RTDyldMemoryManager;
 class Triple;
 class Type;
 
 namespace object {
-  class Archive;
-  class ObjectFile;
-}
+
+class Archive;
+class ObjectFile;
+
+} // end namespace object
 
 /// \brief Helper class for helping synchronize access to the global address map
 /// table.  Access to this class should be serialized under a mutex.
 class ExecutionEngineState {
 public:
-  typedef StringMap<uint64_t> GlobalAddressMapTy;
+  using GlobalAddressMapTy = StringMap<uint64_t>;
 
 private:
-
   /// GlobalAddressMap - A mapping between LLVM global symbol names values and
   /// their actualized version...
   GlobalAddressMapTy GlobalAddressMap;
@@ -74,7 +78,6 @@ private:
   std::map<uint64_t, std::string> GlobalAddressReverseMap;
 
 public:
-
   GlobalAddressMapTy &getGlobalAddressMap() {
     return GlobalAddressMap;
   }
@@ -509,13 +512,15 @@ private:
 };
 
 namespace EngineKind {
+
   // These are actually bitmasks that get or-ed together.
   enum Kind {
     JIT         = 0x1,
     Interpreter = 0x2
   };
   const static Kind Either = (Kind)(JIT | Interpreter);
-}
+
+} // end namespace EngineKind
 
 /// Builder class for ExecutionEngines. Use this by stack-allocating a builder,
 /// chaining the various set* methods, and terminating it with a .create()
@@ -655,6 +660,6 @@ public:
 // Create wrappers for C Binding types (see CBindingWrapping.h).
 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ExecutionEngine, LLVMExecutionEngineRef)
 
-} // End llvm namespace
+} // end namespace llvm
 
-#endif
+#endif // LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
+//===- GenericValue.h - Represent any type of LLVM value --------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -11,18 +11,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #ifndef LLVM_EXECUTIONENGINE_GENERICVALUE_H
 #define LLVM_EXECUTIONENGINE_GENERICVALUE_H
 
 #include "llvm/ADT/APInt.h"
-#include "llvm/Support/DataTypes.h"
 #include <vector>
 
 namespace llvm {
 
-typedef void* PointerTy;
-class APInt;
+using PointerTy = void *;
 
 struct GenericValue {
   struct IntPair {
@@ -30,25 +27,29 @@ struct GenericValue {
     unsigned int second;
   };
   union {
-    double          DoubleVal;
-    float           FloatVal;
-    PointerTy       PointerVal;
-    struct IntPair  UIntPairVal;
-    unsigned char   Untyped[8];
+    double DoubleVal;
+    float FloatVal;
+    PointerTy PointerVal;
+    struct IntPair UIntPairVal;
+    unsigned char Untyped[8];
   };
-  APInt IntVal;   // also used for long doubles.
+  APInt IntVal; // also used for long doubles.
   // For aggregate data types.
   std::vector<GenericValue> AggregateVal;
 
   // to make code faster, set GenericValue to zero could be omitted, but it is
   // potentially can cause problems, since GenericValue to store garbage
   // instead of zero.
-  GenericValue() : IntVal(1,0) {UIntPairVal.first = 0; UIntPairVal.second = 0;}
-  explicit GenericValue(void *V) : PointerVal(V), IntVal(1,0) { }
+  GenericValue() : IntVal(1, 0) {
+    UIntPairVal.first = 0;
+    UIntPairVal.second = 0;
+  }
+  explicit GenericValue(void *V) : PointerVal(V), IntVal(1, 0) {}
 };
 
 inline GenericValue PTOGV(void *P) { return GenericValue(P); }
-inline void* GVTOP(const GenericValue &GV) { return GV.PointerVal; }
+inline void *GVTOP(const GenericValue &GV) { return GV.PointerVal; }
+
+} // end namespace llvm
 
-} // End llvm namespace.
-#endif
+#endif // LLVM_EXECUTIONENGINE_GENERICVALUE_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/JITEventListener.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JITEventListener.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/JITEventListener.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/JITEventListener.h Mon Jun 19 18:37:52 2017
@@ -15,8 +15,8 @@
 #ifndef LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
 #define LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
 
-#include "RuntimeDyld.h"
 #include "llvm/Config/llvm-config.h"
+#include "llvm/ExecutionEngine/RuntimeDyld.h"
 #include "llvm/IR/DebugLoc.h"
 #include <cstdint>
 #include <vector>
@@ -28,7 +28,9 @@ class MachineFunction;
 class OProfileWrapper;
 
 namespace object {
-  class ObjectFile;
+
+class ObjectFile;
+
 } // end namespace object
 
 /// JITEvent_EmittedFunctionDetails - Helper struct for containing information
@@ -57,7 +59,7 @@ struct JITEvent_EmittedFunctionDetails {
 /// The default implementation of each method does nothing.
 class JITEventListener {
 public:
-  typedef JITEvent_EmittedFunctionDetails EmittedFunctionDetails;
+  using EmittedFunctionDetails = JITEvent_EmittedFunctionDetails;
 
 public:
   JITEventListener() = default;

Modified: llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/JITSymbol.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===----------- JITSymbol.h - JIT symbol abstraction -----------*- C++ -*-===//
+//===- JITSymbol.h - JIT symbol abstraction ---------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -26,16 +26,18 @@ namespace llvm {
 class GlobalValue;
 
 namespace object {
-  class BasicSymbolRef;
+
+class BasicSymbolRef;
+
 } // end namespace object
 
 /// @brief Represents an address in the target process's address space.
-typedef uint64_t JITTargetAddress;
+using JITTargetAddress = uint64_t;
 
 /// @brief Flags for symbols in the JIT.
 class JITSymbolFlags {
 public:
-  typedef uint8_t UnderlyingType;
+  using UnderlyingType = uint8_t;
 
   enum FlagNames : UnderlyingType {
     None = 0,
@@ -46,7 +48,7 @@ public:
   };
 
   /// @brief Default-construct a JITSymbolFlags instance.
-  JITSymbolFlags() : Flags(None) {}
+  JITSymbolFlags() = default;
 
   /// @brief Construct a JITSymbolFlags instance from the given flags.
   JITSymbolFlags(FlagNames Flags) : Flags(Flags) {}
@@ -81,15 +83,14 @@ public:
   static JITSymbolFlags fromObjectSymbol(const object::BasicSymbolRef &Symbol);
 
 private:
-  UnderlyingType Flags;
+  UnderlyingType Flags = None;
 };
 
 /// @brief Represents a symbol that has been evaluated to an address already.
 class JITEvaluatedSymbol {
 public:
   /// @brief Create a 'null' symbol.
-  JITEvaluatedSymbol(std::nullptr_t)
-      : Address(0) {}
+  JITEvaluatedSymbol(std::nullptr_t) {}
 
   /// @brief Create a symbol for the given address and flags.
   JITEvaluatedSymbol(JITTargetAddress Address, JITSymbolFlags Flags)
@@ -105,19 +106,18 @@ public:
   JITSymbolFlags getFlags() const { return Flags; }
 
 private:
-  JITTargetAddress Address;
+  JITTargetAddress Address = 0;
   JITSymbolFlags Flags;
 };
 
 /// @brief Represents a symbol in the JIT.
 class JITSymbol {
 public:
-  typedef std::function<JITTargetAddress()> GetAddressFtor;
+  using GetAddressFtor = std::function<JITTargetAddress()>;
 
   /// @brief Create a 'null' symbol that represents failure to find a symbol
   ///        definition.
-  JITSymbol(std::nullptr_t)
-      : CachedAddr(0) {}
+  JITSymbol(std::nullptr_t) {}
 
   /// @brief Create a symbol for a definition with a known address.
   JITSymbol(JITTargetAddress Addr, JITSymbolFlags Flags)
@@ -137,7 +137,7 @@ public:
   /// user can materialize the definition at any time by calling the getAddress
   /// method.
   JITSymbol(GetAddressFtor GetAddress, JITSymbolFlags Flags)
-      : GetAddress(std::move(GetAddress)), CachedAddr(0), Flags(Flags) {}
+      : GetAddress(std::move(GetAddress)), Flags(Flags) {}
 
   /// @brief Returns true if the symbol exists, false otherwise.
   explicit operator bool() const { return CachedAddr || GetAddress; }
@@ -157,7 +157,7 @@ public:
 
 private:
   GetAddressFtor GetAddress;
-  JITTargetAddress CachedAddr;
+  JITTargetAddress CachedAddr = 0;
   JITSymbolFlags Flags;
 };
 

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Mon Jun 19 18:37:52 2017
@@ -24,16 +24,20 @@
 #include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
 #include "llvm/IR/Attributes.h"
+#include "llvm/IR/Constant.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/GlobalAlias.h"
 #include "llvm/IR/GlobalValue.h"
 #include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/Instruction.h"
 #include "llvm/IR/Mangler.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/Type.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Transforms/Utils/ValueMapper.h"
 #include <algorithm>
 #include <cassert>
 #include <functional>
@@ -46,6 +50,9 @@
 #include <vector>
 
 namespace llvm {
+
+class Value;
+
 namespace orc {
 
 /// @brief Compile-on-demand layer.
@@ -77,15 +84,15 @@ private:
     return LambdaMaterializer<MaterializerFtor>(std::move(M));
   }
 
-  typedef typename BaseLayerT::ModuleSetHandleT BaseLayerModuleSetHandleT;
+  using BaseLayerModuleSetHandleT = typename BaseLayerT::ModuleSetHandleT;
 
   // Provide type-erasure for the Modules and MemoryManagers.
   template <typename ResourceT>
   class ResourceOwner {
   public:
     ResourceOwner() = default;
-    ResourceOwner(const ResourceOwner&) = delete;
-    ResourceOwner& operator=(const ResourceOwner&) = delete;
+    ResourceOwner(const ResourceOwner &) = delete;
+    ResourceOwner &operator=(const ResourceOwner &) = delete;
     virtual ~ResourceOwner() = default;
 
     virtual ResourceT& getResource() const = 0;
@@ -106,7 +113,7 @@ private:
   template <typename ResourceT, typename ResourcePtrT>
   std::unique_ptr<ResourceOwner<ResourceT>>
   wrapOwnership(ResourcePtrT ResourcePtr) {
-    typedef ResourceOwnerImpl<ResourceT, ResourcePtrT> RO;
+    using RO = ResourceOwnerImpl<ResourceT, ResourcePtrT>;
     return llvm::make_unique<RO>(std::move(ResourcePtr));
   }
 
@@ -130,21 +137,19 @@ private:
   };
 
   struct LogicalDylib {
-    typedef std::function<JITSymbol(const std::string&)> SymbolResolverFtor;
+    using SymbolResolverFtor = std::function<JITSymbol(const std::string&)>;
 
-    typedef std::function<typename BaseLayerT::ModuleSetHandleT(
-                            BaseLayerT&,
-                            std::unique_ptr<Module>,
-                            std::unique_ptr<JITSymbolResolver>)>
-      ModuleAdderFtor;
+    using ModuleAdderFtor = std::function<typename BaseLayerT::ModuleSetHandleT(
+        BaseLayerT &, std::unique_ptr<Module>,
+        std::unique_ptr<JITSymbolResolver>)>;
 
     struct SourceModuleEntry {
       std::unique_ptr<ResourceOwner<Module>> SourceMod;
       std::set<Function*> StubsToClone;
     };
 
-    typedef std::vector<SourceModuleEntry> SourceModulesList;
-    typedef typename SourceModulesList::size_type SourceModuleHandle;
+    using SourceModulesList = std::vector<SourceModuleEntry>;
+    using SourceModuleHandle = typename SourceModulesList::size_type;
 
     SourceModuleHandle
     addSourceModule(std::unique_ptr<ResourceOwner<Module>> M) {
@@ -186,18 +191,18 @@ private:
     std::vector<BaseLayerModuleSetHandleT> BaseLayerHandles;
   };
 
-  typedef std::list<LogicalDylib> LogicalDylibList;
+  using LogicalDylibList = std::list<LogicalDylib>;
 
 public:
   /// @brief Handle to a set of loaded modules.
-  typedef typename LogicalDylibList::iterator ModuleSetHandleT;
+  using ModuleSetHandleT = typename LogicalDylibList::iterator;
 
   /// @brief Module partitioning functor.
-  typedef std::function<std::set<Function*>(Function&)> PartitioningFtor;
+  using PartitioningFtor = std::function<std::set<Function*>(Function&)>;
 
   /// @brief Builder for IndirectStubsManagers.
-  typedef std::function<std::unique_ptr<IndirectStubsMgrT>()>
-    IndirectStubsManagerBuilderT;
+  using IndirectStubsManagerBuilderT =
+      std::function<std::unique_ptr<IndirectStubsMgrT>()>;
 
   /// @brief Construct a compile-on-demand layer instance.
   CompileOnDemandLayer(BaseLayerT &BaseLayer, PartitioningFtor Partition,
@@ -220,7 +225,6 @@ public:
   ModuleSetHandleT addModuleSet(ModuleSetT Ms,
                                 MemoryManagerPtrT MemMgr,
                                 SymbolResolverPtrT Resolver) {
-
     LogicalDylibs.push_back(LogicalDylib());
     auto &LD = LogicalDylibs.back();
     LD.ExternalSymbolResolver = std::move(Resolver);
@@ -303,7 +307,6 @@ public:
 private:
   template <typename ModulePtrT>
   void addLogicalModule(LogicalDylib &LD, ModulePtrT SrcMPtr) {
-
     // Rename all static functions / globals to $static.X :
     // This will unique the names across all modules in the logical dylib,
     // simplifying symbol lookup.
@@ -581,6 +584,7 @@ private:
 };
 
 } // end namespace orc
+
 } // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_COMPILEONDEMANDLAYER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileUtils.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- CompileUtils.h - Utilities for compiling IR in the JIT --*- C++ -*-===//
+//===- CompileUtils.h - Utilities for compiling IR in the JIT ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,13 +14,24 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H
 #define LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H
 
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ExecutionEngine/ObjectMemoryBuffer.h"
 #include "llvm/IR/LegacyPassManager.h"
-#include "llvm/MC/MCContext.h"
+#include "llvm/Object/Binary.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
+#include <algorithm>
+#include <memory>
 
 namespace llvm {
+
+class MCContext;
+class Module;
+
 namespace orc {
 
 /// @brief Simple compile functor: Takes a single IR module and returns an
@@ -44,7 +55,7 @@ public:
         new ObjectMemoryBuffer(std::move(ObjBufferSV)));
     Expected<std::unique_ptr<object::ObjectFile>> Obj =
         object::ObjectFile::createObjectFile(ObjBuffer->getMemBufferRef());
-    typedef object::OwningBinary<object::ObjectFile> OwningObj;
+    using OwningObj = object::OwningBinary<object::ObjectFile>;
     if (Obj)
       return OwningObj(std::move(*Obj), std::move(ObjBuffer));
     // TODO: Actually report errors helpfully.
@@ -56,7 +67,8 @@ private:
   TargetMachine &TM;
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_COMPILEUTILS_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- ExecutionUtils.h - Utilities for executing code in Orc --*- C++ -*-===//
+//===- ExecutionUtils.h - Utilities for executing code in Orc ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,8 +17,11 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
-#include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include <algorithm>
+#include <cstdint>
+#include <string>
 #include <vector>
+#include <utility>
 
 namespace llvm {
 
@@ -37,7 +40,6 @@ namespace orc {
 /// getConstructors/getDestructors functions.
 class CtorDtorIterator {
 public:
-
   /// @brief Accessor for an element of the global_ctors/global_dtors array.
   ///
   ///   This class provides a read-only view of the element with any casts on
@@ -89,7 +91,6 @@ iterator_range<CtorDtorIterator> getDest
 template <typename JITLayerT>
 class CtorDtorRunner {
 public:
-
   /// @brief Construct a CtorDtorRunner for the given range using the given
   ///        name mangling function.
   CtorDtorRunner(std::vector<std::string> CtorDtorNames,
@@ -99,7 +100,7 @@ public:
   /// @brief Run the recorded constructors/destructors through the given JIT
   ///        layer.
   bool runViaLayer(JITLayerT &JITLayer) const {
-    typedef void (*CtorDtorTy)();
+    using CtorDtorTy = void (*)();
 
     bool Error = false;
     for (const auto &CtorDtorName : CtorDtorNames)
@@ -135,7 +136,6 @@ private:
 /// called.
 class LocalCXXRuntimeOverrides {
 public:
-
   /// Create a runtime-overrides class.
   template <typename MangleFtorT>
   LocalCXXRuntimeOverrides(const MangleFtorT &Mangle) {
@@ -156,7 +156,6 @@ public:
   void runDestructors();
 
 private:
-
   template <typename PtrTy>
   JITTargetAddress toTargetAddress(PtrTy* P) {
     return static_cast<JITTargetAddress>(reinterpret_cast<uintptr_t>(P));
@@ -168,15 +167,16 @@ private:
 
   StringMap<JITTargetAddress> CXXRuntimeOverrides;
 
-  typedef void (*DestructorPtr)(void*);
-  typedef std::pair<DestructorPtr, void*> CXXDestructorDataPair;
-  typedef std::vector<CXXDestructorDataPair> CXXDestructorDataPairList;
+  using DestructorPtr = void (*)(void *);
+  using CXXDestructorDataPair = std::pair<DestructorPtr, void *>;
+  using CXXDestructorDataPairList = std::vector<CXXDestructorDataPair>;
   CXXDestructorDataPairList DSOHandleOverride;
   static int CXAAtExitOverride(DestructorPtr Destructor, void *Arg,
                                void *DSOHandle);
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_EXECUTIONUTILS_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/GlobalMappingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/GlobalMappingLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/GlobalMappingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/GlobalMappingLayer.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===---- GlobalMappingLayer.h - Run all IR through a functor ---*- C++ -*-===//
+//===- GlobalMappingLayer.h - Run all IR through a functor ------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,6 +17,7 @@
 
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include <map>
+#include <string>
 
 namespace llvm {
 namespace orc {
@@ -32,7 +33,7 @@ template <typename BaseLayerT>
 class GlobalMappingLayer {
 public:
   /// @brief Handle to a set of added modules.
-  typedef typename BaseLayerT::ModuleSetHandleT ModuleSetHandleT;
+  using ModuleSetHandleT = typename BaseLayerT::ModuleSetHandleT;
 
   /// @brief Construct an GlobalMappingLayer with the given BaseLayer
   GlobalMappingLayer(BaseLayerT &BaseLayer) : BaseLayer(BaseLayer) {}
@@ -102,7 +103,7 @@ private:
   std::map<std::string, JITTargetAddress> SymbolTable;
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_GLOBALMAPPINGLAYER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===------ IRCompileLayer.h -- Eagerly compile IR for JIT ------*- C++ -*-===//
+//===- IRCompileLayer.h -- Eagerly compile IR for JIT -----------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,12 +14,23 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
 #define LLVM_EXECUTIONENGINE_ORC_IRCOMPILELAYER_H
 
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/ObjectCache.h"
+#include "llvm/Object/Binary.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include <algorithm>
+#include <functional>
 #include <memory>
+#include <string>
+#include <vector>
 
 namespace llvm {
+
+class Module;
+
 namespace orc {
 
 /// @brief Eager IR compiling layer.
@@ -30,20 +41,20 @@ namespace orc {
 /// the layer below, which must implement the object layer concept.
 template <typename BaseLayerT> class IRCompileLayer {
 public:
-  typedef std::function<object::OwningBinary<object::ObjectFile>(Module &)>
-      CompileFtor;
+  using CompileFtor =
+      std::function<object::OwningBinary<object::ObjectFile>(Module &)>;
 
 private:
-  typedef typename BaseLayerT::ObjSetHandleT ObjSetHandleT;
+  using ObjSetHandleT = typename BaseLayerT::ObjSetHandleT;
 
 public:
   /// @brief Handle to a set of compiled modules.
-  typedef ObjSetHandleT ModuleSetHandleT;
+  using ModuleSetHandleT = ObjSetHandleT;
 
   /// @brief Construct an IRCompileLayer with the given BaseLayer, which must
   ///        implement the ObjectLayer concept.
   IRCompileLayer(BaseLayerT &BaseLayer, CompileFtor Compile)
-      : BaseLayer(BaseLayer), Compile(std::move(Compile)), ObjCache(nullptr) {}
+      : BaseLayer(BaseLayer), Compile(std::move(Compile)) {}
 
   /// @brief Set an ObjectCache to query before compiling.
   void setObjectCache(ObjectCache *NewCache) { ObjCache = NewCache; }
@@ -137,10 +148,11 @@ private:
 
   BaseLayerT &BaseLayer;
   CompileFtor Compile;
-  ObjectCache *ObjCache;
+  ObjectCache *ObjCache = nullptr;
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_IRCOMPILINGLAYER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===----- IRTransformLayer.h - Run all IR through a functor ----*- C++ -*-===//
+//===- IRTransformLayer.h - Run all IR through a functor --------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,6 +15,7 @@
 #define LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H
 
 #include "llvm/ExecutionEngine/JITSymbol.h"
+#include <string>
 
 namespace llvm {
 namespace orc {
@@ -28,7 +29,7 @@ template <typename BaseLayerT, typename
 class IRTransformLayer {
 public:
   /// @brief Handle to a set of added modules.
-  typedef typename BaseLayerT::ModuleSetHandleT ModuleSetHandleT;
+  using ModuleSetHandleT = typename BaseLayerT::ModuleSetHandleT;
 
   /// @brief Construct an IRTransformLayer with the given BaseLayer
   IRTransformLayer(BaseLayerT &BaseLayer,
@@ -45,7 +46,6 @@ public:
   ModuleSetHandleT addModuleSet(ModuleSetT Ms,
                                 MemoryManagerPtrT MemMgr,
                                 SymbolResolverPtrT Resolver) {
-
     for (auto I = Ms.begin(), E = Ms.end(); I != E; ++I)
       *I = Transform(std::move(*I));
 
@@ -95,7 +95,7 @@ private:
   TransformFtor Transform;
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_IRTRANSFORMLAYER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- IndirectionUtils.h - Utilities for adding indirections --*- C++ -*-===//
+//===- IndirectionUtils.h - Utilities for adding indirections ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -18,9 +18,6 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
-#include "llvm/IR/IRBuilder.h"
-#include "llvm/IR/Mangler.h"
-#include "llvm/IR/Module.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Memory.h"
 #include "llvm/Support/Process.h"
@@ -36,12 +33,23 @@
 #include <vector>
 
 namespace llvm {
+
+class Constant;
+class Function;
+class FunctionType;
+class GlobalAlias;
+class GlobalVariable;
+class Module;
+class PointerType;
+class Triple;
+class Value;
+
 namespace orc {
 
 /// @brief Target-independent base class for compile callback management.
 class JITCompileCallbackManager {
 public:
-  typedef std::function<JITTargetAddress()> CompileFtor;
+  using CompileFtor = std::function<JITTargetAddress()>;
 
   /// @brief Handle to a newly created compile callback. Can be used to get an
   ///        IR constant representing the address of the trampoline, and to set
@@ -125,7 +133,7 @@ public:
 protected:
   JITTargetAddress ErrorHandlerAddress;
 
-  typedef std::map<JITTargetAddress, CompileFtor> TrampolineMapT;
+  using TrampolineMapT = std::map<JITTargetAddress, CompileFtor>;
   TrampolineMapT ActiveTrampolines;
   std::vector<JITTargetAddress> AvailableTrampolines;
 
@@ -155,7 +163,6 @@ public:
   ///                            process to be used if a compile callback fails.
   LocalJITCompileCallbackManager(JITTargetAddress ErrorHandlerAddress)
       : JITCompileCallbackManager(ErrorHandlerAddress) {
-
     /// Set up the resolver block.
     std::error_code EC;
     ResolverBlock = sys::OwningMemoryBlock(sys::Memory::allocateMappedMemory(
@@ -220,7 +227,7 @@ private:
 class IndirectStubsManager {
 public:
   /// @brief Map type for initializing the manager. See init.
-  typedef StringMap<std::pair<JITTargetAddress, JITSymbolFlags>> StubInitsMap;
+  using StubInitsMap = StringMap<std::pair<JITTargetAddress, JITSymbolFlags>>;
 
   virtual ~IndirectStubsManager() = default;
 
@@ -336,7 +343,7 @@ private:
   }
 
   std::vector<typename TargetT::IndirectStubsInfo> IndirectStubsInfos;
-  typedef std::pair<uint16_t, uint16_t> StubKey;
+  using StubKey = std::pair<uint16_t, uint16_t>;
   std::vector<StubKey> FreeStubs;
   StringMap<std::pair<StubKey, JITSymbolFlags>> StubIndexes;
 };
@@ -432,6 +439,7 @@ void cloneModuleFlagsMetadata(Module &Ds
                               ValueToValueMapTy &VMap);
 
 } // end namespace orc
+
 } // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_INDIRECTIONUTILS_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LambdaResolver.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LambdaResolver.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LambdaResolver.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LambdaResolver.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- LambdaResolverMM - Redirect symbol lookup via a functor -*- C++ -*-===//
+//===- LambdaResolverMM - Redirect symbol lookup via a functor --*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,7 +16,7 @@
 #define LLVM_EXECUTIONENGINE_ORC_LAMBDARESOLVER_H
 
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
 #include <memory>
 
 namespace llvm {
@@ -25,7 +25,6 @@ namespace orc {
 template <typename DylibLookupFtorT, typename ExternalLookupFtorT>
 class LambdaResolver : public JITSymbolResolver {
 public:
-
   LambdaResolver(DylibLookupFtorT DylibLookupFtor,
                  ExternalLookupFtorT ExternalLookupFtor)
       : DylibLookupFtor(DylibLookupFtor),
@@ -49,12 +48,12 @@ template <typename DylibLookupFtorT,
 std::unique_ptr<LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>>
 createLambdaResolver(DylibLookupFtorT DylibLookupFtor,
                      ExternalLookupFtorT ExternalLookupFtor) {
-  typedef LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT> LR;
+  using LR = LambdaResolver<DylibLookupFtorT, ExternalLookupFtorT>;
   return make_unique<LR>(std::move(DylibLookupFtor),
                          std::move(ExternalLookupFtor));
 }
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_LAMBDARESOLVER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Mon Jun 19 18:37:52 2017
@@ -40,7 +40,7 @@ namespace orc {
 /// (via JITSymbol::getAddress) for a symbol contained in this layer.
 template <typename BaseLayerT> class LazyEmittingLayer {
 public:
-  typedef typename BaseLayerT::ModuleSetHandleT BaseLayerHandleT;
+  using BaseLayerHandleT = typename BaseLayerT::ModuleSetHandleT;
 
 private:
   class EmissionDeferredSet {
@@ -216,14 +216,14 @@ private:
     mutable std::unique_ptr<StringMap<const GlobalValue*>> MangledSymbols;
   };
 
-  typedef std::list<std::unique_ptr<EmissionDeferredSet>> ModuleSetListT;
+  using ModuleSetListT = std::list<std::unique_ptr<EmissionDeferredSet>>;
 
   BaseLayerT &BaseLayer;
   ModuleSetListT ModuleSetList;
 
 public:
   /// @brief Handle to a set of loaded modules.
-  typedef typename ModuleSetListT::iterator ModuleSetHandleT;
+  using ModuleSetHandleT = typename ModuleSetListT::iterator;
 
   /// @brief Construct a lazy emitting layer.
   LazyEmittingLayer(BaseLayerT &BaseLayer) : BaseLayer(BaseLayer) {}
@@ -291,8 +291,8 @@ std::unique_ptr<typename LazyEmittingLay
 LazyEmittingLayer<BaseLayerT>::EmissionDeferredSet::create(
     BaseLayerT &B, ModuleSetT Ms, MemoryManagerPtrT MemMgr,
     SymbolResolverPtrT Resolver) {
-  typedef EmissionDeferredSetImpl<ModuleSetT, MemoryManagerPtrT, SymbolResolverPtrT>
-    EDS;
+  using EDS = EmissionDeferredSetImpl<ModuleSetT, MemoryManagerPtrT,
+                                      SymbolResolverPtrT>;
   return llvm::make_unique<EDS>(std::move(Ms), std::move(MemMgr),
                                 std::move(Resolver));
 }

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/ObjectTransformLayer.h Mon Jun 19 18:37:52 2017
@@ -15,6 +15,8 @@
 #define LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H
 
 #include "llvm/ExecutionEngine/JITSymbol.h"
+#include <algorithm>
+#include <string>
 
 namespace llvm {
 namespace orc {
@@ -28,7 +30,7 @@ template <typename BaseLayerT, typename
 class ObjectTransformLayer {
 public:
   /// @brief Handle to a set of added objects.
-  typedef typename BaseLayerT::ObjSetHandleT ObjSetHandleT;
+  using ObjSetHandleT = typename BaseLayerT::ObjSetHandleT;
 
   /// @brief Construct an ObjectTransformLayer with the given BaseLayer
   ObjectTransformLayer(BaseLayerT &BaseLayer,
@@ -44,7 +46,6 @@ public:
             typename SymbolResolverPtrT>
   ObjSetHandleT addObjectSet(ObjSetT Objects, MemoryManagerPtrT MemMgr,
                              SymbolResolverPtrT Resolver) {
-
     for (auto I = Objects.begin(), E = Objects.end(); I != E; ++I)
       *I = Transform(std::move(*I));
 
@@ -98,7 +99,7 @@ private:
   TransformFtor Transform;
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_OBJECTTRANSFORMLAYER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcABISupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcABISupport.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcABISupport.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcABISupport.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-------------- OrcABISupport.h - ABI support code  ---------*- C++ -*-===//
+//===- OrcABISupport.h - ABI support code -----------------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -18,9 +18,12 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCABISUPPORT_H
 #define LLVM_EXECUTIONENGINE_ORC_ORCABISUPPORT_H
 
-#include "IndirectionUtils.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Memory.h"
-#include "llvm/Support/Process.h"
+#include <algorithm>
+#include <cstdint>
 
 namespace llvm {
 namespace orc {
@@ -37,8 +40,8 @@ public:
   static const unsigned TrampolineSize = 1;
   static const unsigned ResolverCodeSize = 1;
 
-  typedef JITTargetAddress (*JITReentryFn)(void *CallbackMgr,
-                                           void *TrampolineId);
+  using JITReentryFn = JITTargetAddress (*)(void *CallbackMgr,
+                                            void *TrampolineId);
 
   static void writeResolverCode(uint8_t *ResolveMem, JITReentryFn Reentry,
                                 void *CallbackMgr) {
@@ -55,6 +58,7 @@ public:
   class IndirectStubsInfo {
   public:
     const static unsigned StubSize = 1;
+
     unsigned getNumStubs() const { llvm_unreachable("Not supported"); }
     void *getStub(unsigned Idx) const { llvm_unreachable("Not supported"); }
     void **getPtr(unsigned Idx) const { llvm_unreachable("Not supported"); }
@@ -73,13 +77,14 @@ template <unsigned StubSizeVal> class Ge
 public:
   const static unsigned StubSize = StubSizeVal;
 
-  GenericIndirectStubsInfo() : NumStubs(0) {}
+  GenericIndirectStubsInfo() = default;
   GenericIndirectStubsInfo(unsigned NumStubs, sys::OwningMemoryBlock StubsMem)
       : NumStubs(NumStubs), StubsMem(std::move(StubsMem)) {}
   GenericIndirectStubsInfo(GenericIndirectStubsInfo &&Other)
       : NumStubs(Other.NumStubs), StubsMem(std::move(Other.StubsMem)) {
     Other.NumStubs = 0;
   }
+
   GenericIndirectStubsInfo &operator=(GenericIndirectStubsInfo &&Other) {
     NumStubs = Other.NumStubs;
     Other.NumStubs = 0;
@@ -104,7 +109,7 @@ public:
   }
 
 private:
-  unsigned NumStubs;
+  unsigned NumStubs = 0;
   sys::OwningMemoryBlock StubsMem;
 };
 
@@ -114,10 +119,10 @@ public:
   static const unsigned TrampolineSize = 12;
   static const unsigned ResolverCodeSize = 0x120;
 
-  typedef GenericIndirectStubsInfo<8> IndirectStubsInfo;
+  using IndirectStubsInfo = GenericIndirectStubsInfo<8>;
 
-  typedef JITTargetAddress (*JITReentryFn)(void *CallbackMgr,
-                                           void *TrampolineId);
+  using JITReentryFn = JITTargetAddress (*)(void *CallbackMgr,
+                                            void *TrampolineId);
 
   /// @brief Write the resolver code into the given memory. The user is be
   ///        responsible for allocating the memory and setting permissions.
@@ -148,7 +153,7 @@ public:
   static const unsigned PointerSize = 8;
   static const unsigned TrampolineSize = 8;
 
-  typedef GenericIndirectStubsInfo<8> IndirectStubsInfo;
+  using IndirectStubsInfo = GenericIndirectStubsInfo<8>;
 
   /// @brief Write the requsted number of trampolines into the given memory,
   ///        which must be big enough to hold 1 pointer, plus NumTrampolines
@@ -172,8 +177,9 @@ public:
 class OrcX86_64_SysV : public OrcX86_64_Base {
 public:
   static const unsigned ResolverCodeSize = 0x6C;
-  typedef JITTargetAddress (*JITReentryFn)(void *CallbackMgr,
-                                           void *TrampolineId);
+
+  using JITReentryFn = JITTargetAddress (*)(void *CallbackMgr,
+                                            void *TrampolineId);
 
   /// @brief Write the resolver code into the given memory. The user is be
   ///        responsible for allocating the memory and setting permissions.
@@ -187,8 +193,9 @@ public:
 class OrcX86_64_Win32 : public OrcX86_64_Base {
 public:
   static const unsigned ResolverCodeSize = 0x74;
-  typedef JITTargetAddress (*JITReentryFn)(void *CallbackMgr,
-                                           void *TrampolineId);
+
+  using JITReentryFn = JITTargetAddress (*)(void *CallbackMgr,
+                                            void *TrampolineId);
 
   /// @brief Write the resolver code into the given memory. The user is be
   ///        responsible for allocating the memory and setting permissions.
@@ -205,10 +212,10 @@ public:
   static const unsigned TrampolineSize = 8;
   static const unsigned ResolverCodeSize = 0x4a;
 
-  typedef GenericIndirectStubsInfo<8> IndirectStubsInfo;
+  using IndirectStubsInfo = GenericIndirectStubsInfo<8>;
 
-  typedef JITTargetAddress (*JITReentryFn)(void *CallbackMgr,
-                                           void *TrampolineId);
+  using JITReentryFn = JITTargetAddress (*)(void *CallbackMgr,
+                                            void *TrampolineId);
 
   /// @brief Write the resolver code into the given memory. The user is be
   ///        responsible for allocating the memory and setting permissions.
@@ -231,7 +238,7 @@ public:
                                       unsigned MinStubs, void *InitialPtrVal);
 };
 
-} // End namespace orc.
-} // End namespace llvm.
+} // end namespace orc
+} // end namespace llvm
 
 #endif // LLVM_EXECUTIONENGINE_ORC_ORCABISUPPORT_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===---- OrcRemoteTargetClient.h - Orc Remote-target Client ----*- C++ -*-===//
+//===- OrcRemoteTargetClient.h - Orc Remote-target Client -------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,10 +16,29 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETCLIENT_H
 #define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETCLIENT_H
 
-#include "IndirectionUtils.h"
-#include "OrcRemoteTargetRPCAPI.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
+#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
+#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
-#include <system_error>
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Format.h"
+#include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Memory.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <tuple>
+#include <utility>
+#include <vector>
 
 #define DEBUG_TYPE "orc-remote"
 
@@ -207,7 +226,6 @@ public:
       DEBUG(dbgs() << "Allocator " << Id << " finalizing:\n");
 
       for (auto &ObjAllocs : Unfinalized) {
-
         for (auto &Alloc : ObjAllocs.CodeAllocs) {
           DEBUG(dbgs() << "  copying code: "
                        << static_cast<void *>(Alloc.getLocalAddress()) << " -> "
@@ -469,7 +487,7 @@ public:
     OrcRemoteTargetClient &Remote;
     ResourceIdMgr::ResourceId Id;
     std::vector<RemoteIndirectStubsInfo> RemoteIndirectStubsInfos;
-    typedef std::pair<uint16_t, uint16_t> StubKey;
+    using StubKey = std::pair<uint16_t, uint16_t>;
     std::vector<StubKey> FreeStubs;
     StringMap<std::pair<StubKey, JITSymbolFlags>> StubIndexes;
 
@@ -710,7 +728,6 @@ private:
 
   Expected<JITTargetAddress> reserveMem(ResourceIdMgr::ResourceId Id,
                                         uint64_t Size, uint32_t Align) {
-
     // Check for an 'out-of-band' error, e.g. from an MM destructor.
     if (ExistingError)
       return std::move(ExistingError);

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===--- OrcRemoteTargetRPCAPI.h - Orc Remote-target RPC API ----*- C++ -*-===//
+//===- OrcRemoteTargetRPCAPI.h - Orc Remote-target RPC API ------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,12 +16,13 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H
 #define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H
 
-#include "RPCUtils.h"
-#include "RawByteChannel.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
+#include "llvm/ExecutionEngine/Orc/RPCUtils.h"
+#include "llvm/ExecutionEngine/Orc/RawByteChannel.h"
 
 namespace llvm {
 namespace orc {
+
 namespace remote {
 
 class DirectBufferWriter {
@@ -72,7 +73,7 @@ public:
       return EC;
     char *Addr = reinterpret_cast<char *>(static_cast<uintptr_t>(Dst));
 
-    DBW = remote::DirectBufferWriter(0, Dst, Size);
+    DBW = remote::DirectBufferWriter(nullptr, Dst, Size);
 
     return C.readBytes(Addr, Size);
   }
@@ -87,7 +88,7 @@ class OrcRemoteTargetRPCAPI
 protected:
   class ResourceIdMgr {
   public:
-    typedef uint64_t ResourceId;
+    using ResourceId = uint64_t;
     static const ResourceId InvalidId = ~0U;
 
     ResourceId getNext() {
@@ -98,6 +99,7 @@ protected:
       }
       return NextId++;
     }
+
     void release(ResourceId I) { FreeIds.push_back(I); }
 
   private:
@@ -261,7 +263,8 @@ public:
 };
 
 } // end namespace remote
+
 } // end namespace orc
 } // end namespace llvm
 
-#endif
+#endif // LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETRPCAPI_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===---- OrcRemoteTargetServer.h - Orc Remote-target Server ----*- C++ -*-===//
+//===- OrcRemoteTargetServer.h - Orc Remote-target Server -------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,10 +15,9 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETSERVER_H
 #define LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETSERVER_H
 
-#include "OrcRemoteTargetRPCAPI.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/Orc/OrcError.h"
-#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
+#include "llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Format.h"
@@ -48,20 +47,18 @@ namespace remote {
 template <typename ChannelT, typename TargetT>
 class OrcRemoteTargetServer : public OrcRemoteTargetRPCAPI {
 public:
-  typedef std::function<JITTargetAddress(const std::string &Name)>
-      SymbolLookupFtor;
+  using SymbolLookupFtor =
+      std::function<JITTargetAddress(const std::string &Name)>;
 
-  typedef std::function<void(uint8_t *Addr, uint32_t Size)>
-      EHFrameRegistrationFtor;
+  using EHFrameRegistrationFtor =
+      std::function<void(uint8_t *Addr, uint32_t Size)>;
 
   OrcRemoteTargetServer(ChannelT &Channel, SymbolLookupFtor SymbolLookup,
                         EHFrameRegistrationFtor EHFramesRegister,
                         EHFrameRegistrationFtor EHFramesDeregister)
       : OrcRemoteTargetRPCAPI(Channel), SymbolLookup(std::move(SymbolLookup)),
         EHFramesRegister(std::move(EHFramesRegister)),
-        EHFramesDeregister(std::move(EHFramesDeregister)),
-        TerminateFlag(false) {
-
+        EHFramesDeregister(std::move(EHFramesDeregister)) {
     using ThisT = typename std::remove_reference<decltype(*this)>::type;
     addHandler<CallIntVoid>(*this, &ThisT::handleCallIntVoid);
     addHandler<CallMain>(*this, &ThisT::handleCallMain);
@@ -106,6 +103,7 @@ private:
   struct Allocator {
     Allocator() = default;
     Allocator(Allocator &&Other) : Allocs(std::move(Other.Allocs)) {}
+
     Allocator &operator=(Allocator &&Other) {
       Allocs = std::move(Other.Allocs);
       return *this;
@@ -153,7 +151,8 @@ private:
   }
 
   Expected<int32_t> handleCallIntVoid(JITTargetAddress Addr) {
-    typedef int (*IntVoidFnTy)();
+    using IntVoidFnTy = int (*)();
+
     IntVoidFnTy Fn =
         reinterpret_cast<IntVoidFnTy>(static_cast<uintptr_t>(Addr));
 
@@ -166,7 +165,7 @@ private:
 
   Expected<int32_t> handleCallMain(JITTargetAddress Addr,
                                    std::vector<std::string> Args) {
-    typedef int (*MainFnTy)(int, const char *[]);
+    using MainFnTy = int (*)(int, const char *[]);
 
     MainFnTy Fn = reinterpret_cast<MainFnTy>(static_cast<uintptr_t>(Addr));
     int ArgC = Args.size() + 1;
@@ -184,7 +183,8 @@ private:
   }
 
   Error handleCallVoidVoid(JITTargetAddress Addr) {
-    typedef void (*VoidVoidFnTy)();
+    using VoidVoidFnTy = void (*)();
+
     VoidVoidFnTy Fn =
         reinterpret_cast<VoidVoidFnTy>(static_cast<uintptr_t>(Addr));
 
@@ -420,11 +420,11 @@ private:
   SymbolLookupFtor SymbolLookup;
   EHFrameRegistrationFtor EHFramesRegister, EHFramesDeregister;
   std::map<ResourceIdMgr::ResourceId, Allocator> Allocators;
-  typedef std::vector<typename TargetT::IndirectStubsInfo> ISBlockOwnerList;
+  using ISBlockOwnerList = std::vector<typename TargetT::IndirectStubsInfo>;
   std::map<ResourceIdMgr::ResourceId, ISBlockOwnerList> IndirectStubsOwners;
   sys::OwningMemoryBlock ResolverBlock;
   std::vector<sys::OwningMemoryBlock> TrampolineBlocks;
-  bool TerminateFlag;
+  bool TerminateFlag = false;
 };
 
 } // end namespace remote
@@ -433,4 +433,4 @@ private:
 
 #undef DEBUG_TYPE
 
-#endif
+#endif // LLVM_EXECUTIONENGINE_ORC_ORCREMOTETARGETSERVER_H

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- RTDyldObjectLinkingLayer.h - RTDyld-based jit linking  --*- C++ -*-===//
+//===- RTDyldObjectLinkingLayer.h - RTDyld-based jit linking  ---*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,10 +17,8 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
-#include "llvm/ExecutionEngine/SectionMemoryManager.h"
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Support/Error.h"
 #include <algorithm>
@@ -76,11 +74,11 @@ protected:
     bool Finalized = false;
   };
 
-  typedef std::list<std::unique_ptr<LinkedObjectSet>> LinkedObjectSetListT;
+  using LinkedObjectSetListT = std::list<std::unique_ptr<LinkedObjectSet>>;
 
 public:
   /// @brief Handle to a set of loaded objects.
-  typedef LinkedObjectSetListT::iterator ObjSetHandleT;
+  using ObjSetHandleT = LinkedObjectSetListT::iterator;
 };
 
 /// @brief Default (no-op) action to perform when loading objects.
@@ -101,7 +99,7 @@ template <typename NotifyLoadedFtor = Do
 class RTDyldObjectLinkingLayer : public RTDyldObjectLinkingLayerBase {
 public:
   /// @brief Functor for receiving finalization notifications.
-  typedef std::function<void(ObjSetHandleT)> NotifyFinalizedFtor;
+  using NotifyFinalizedFtor = std::function<void(ObjSetHandleT)>;
 
 private:
   template <typename ObjSetT, typename MemoryManagerPtrT,
@@ -216,8 +214,8 @@ private:
                         SymbolResolverPtrT Resolver,
                         FinalizerFtor Finalizer,
                         bool ProcessAllSections) {
-    typedef ConcreteLinkedObjectSet<ObjSetT, MemoryManagerPtrT,
-                                    SymbolResolverPtrT, FinalizerFtor> LOS;
+    using LOS = ConcreteLinkedObjectSet<ObjSetT, MemoryManagerPtrT,
+                                        SymbolResolverPtrT, FinalizerFtor>;
     return llvm::make_unique<LOS>(std::move(Objects), std::move(MemMgr),
                                   std::move(Resolver), std::move(Finalizer),
                                   ProcessAllSections);
@@ -226,8 +224,8 @@ private:
 public:
   /// @brief LoadedObjectInfo list. Contains a list of owning pointers to
   ///        RuntimeDyld::LoadedObjectInfo instances.
-  typedef std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>
-      LoadedObjInfoList;
+  using LoadedObjInfoList =
+      std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>;
 
   /// @brief Construct an ObjectLinkingLayer with the given NotifyLoaded,
   ///        and NotifyFinalized functors.
@@ -235,8 +233,7 @@ public:
       NotifyLoadedFtor NotifyLoaded = NotifyLoadedFtor(),
       NotifyFinalizedFtor NotifyFinalized = NotifyFinalizedFtor())
       : NotifyLoaded(std::move(NotifyLoaded)),
-        NotifyFinalized(std::move(NotifyFinalized)),
-        ProcessAllSections(false) {}
+        NotifyFinalized(std::move(NotifyFinalized)) {}
 
   /// @brief Set the 'ProcessAllSections' flag.
   ///
@@ -357,7 +354,7 @@ private:
   LinkedObjectSetListT LinkedObjSetList;
   NotifyLoadedFtor NotifyLoaded;
   NotifyFinalizedFtor NotifyFinalized;
-  bool ProcessAllSections;
+  bool ProcessAllSections = false;
 };
 
 } // end namespace orc

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/RawByteChannel.h Mon Jun 19 18:37:52 2017
@@ -10,20 +10,14 @@
 #ifndef LLVM_EXECUTIONENGINE_ORC_RAWBYTECHANNEL_H
 #define LLVM_EXECUTIONENGINE_ORC_RAWBYTECHANNEL_H
 
-#include "OrcError.h"
-#include "RPCSerialization.h"
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ExecutionEngine/Orc/RPCSerialization.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
-#include <cstddef>
 #include <cstdint>
 #include <mutex>
 #include <string>
-#include <tuple>
 #include <type_traits>
-#include <vector>
 
 namespace llvm {
 namespace orc {
@@ -32,7 +26,7 @@ namespace rpc {
 /// Interface for byte-streams to be used with RPC.
 class RawByteChannel {
 public:
-  virtual ~RawByteChannel() {}
+  virtual ~RawByteChannel() = default;
 
   /// Read Size bytes from the stream into *Dst.
   virtual Error readBytes(char *Dst, unsigned Size) = 0;

Modified: llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/RuntimeDyld.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===-- RuntimeDyld.h - Run-time dynamic linker for MC-JIT ------*- C++ -*-===//
+//===- RuntimeDyld.h - Run-time dynamic linker for MC-JIT -------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -32,7 +32,9 @@
 namespace llvm {
 
 namespace object {
-  template <typename T> class OwningBinary;
+
+template <typename T> class OwningBinary;
+
 } // end namespace object
 
 /// Base class for errors originating in RuntimeDyld, e.g. missing relocation
@@ -51,8 +53,8 @@ private:
   std::string ErrMsg;
 };
 
-class RuntimeDyldImpl;
 class RuntimeDyldCheckerImpl;
+class RuntimeDyldImpl;
 
 class RuntimeDyld {
   friend class RuntimeDyldCheckerImpl;
@@ -68,7 +70,7 @@ public:
     friend class RuntimeDyldImpl;
 
   public:
-    typedef std::map<object::SectionRef, unsigned> ObjSectionToIDMap;
+    using ObjSectionToIDMap = std::map<object::SectionRef, unsigned>;
 
     LoadedObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
         : RTDyld(RTDyld), ObjSecToIDMap(std::move(ObjSecToIDMap)) {}
@@ -186,7 +188,7 @@ public:
   /// \brief Construct a RuntimeDyld instance.
   RuntimeDyld(MemoryManager &MemMgr, JITSymbolResolver &Resolver);
   RuntimeDyld(const RuntimeDyld &) = delete;
-  void operator=(const RuntimeDyld &) = delete;
+  RuntimeDyld &operator=(const RuntimeDyld &) = delete;
   ~RuntimeDyld();
 
   /// Add the referenced object file to the list of objects to be loaded and

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcCBindingsStack.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===--- OrcCBindingsStack.h - Orc JIT stack for C bindings ---*- C++ -*---===//
+//===- OrcCBindingsStack.h - Orc JIT stack for C bindings -----*- C++ -*---===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -11,14 +11,32 @@
 #define LLVM_LIB_EXECUTIONENGINE_ORC_ORCCBINDINGSSTACK_H
 
 #include "llvm-c/OrcBindings.h"
-#include "llvm/ADT/Triple.h"
+#include "llvm-c/TargetMachine.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
+#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
 #include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
-#include "llvm/IR/LLVMContext.h"
+#include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/Mangler.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetMachine.h"
+#include <algorithm>
+#include <cstdint>
+#include <functional>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
 
 namespace llvm {
 
@@ -29,21 +47,22 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Targe
 
 class OrcCBindingsStack {
 public:
-  typedef orc::JITCompileCallbackManager CompileCallbackMgr;
-  typedef orc::RTDyldObjectLinkingLayer<> ObjLayerT;
-  typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
-  typedef orc::CompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>
-      CODLayerT;
+  using CompileCallbackMgr = orc::JITCompileCallbackManager;
+  using ObjLayerT = orc::RTDyldObjectLinkingLayer<>;
+  using CompileLayerT = orc::IRCompileLayer<ObjLayerT>;
+  using CODLayerT =
+      orc::CompileOnDemandLayer<CompileLayerT, CompileCallbackMgr>;
 
-  typedef std::function<std::unique_ptr<CompileCallbackMgr>()>
-      CallbackManagerBuilder;
+  using CallbackManagerBuilder =
+      std::function<std::unique_ptr<CompileCallbackMgr>()>;
 
-  typedef CODLayerT::IndirectStubsManagerBuilderT IndirectStubsManagerBuilder;
+  using IndirectStubsManagerBuilder = CODLayerT::IndirectStubsManagerBuilderT;
 
 private:
   class GenericHandle {
   public:
-    virtual ~GenericHandle() {}
+    virtual ~GenericHandle() = default;
+
     virtual JITSymbol findSymbolIn(const std::string &Name,
                                    bool ExportedSymbolsOnly) = 0;
     virtual void removeModule() = 0;
@@ -75,15 +94,15 @@ private:
 
 public:
   // We need a 'ModuleSetHandleT' to conform to the layer concept.
-  typedef unsigned ModuleSetHandleT;
+  using ModuleSetHandleT = unsigned;
 
-  typedef unsigned ModuleHandleT;
+  using ModuleHandleT = unsigned;
 
   OrcCBindingsStack(TargetMachine &TM,
                     std::unique_ptr<CompileCallbackMgr> CCMgr,
                     IndirectStubsManagerBuilder IndirectStubsMgrBuilder)
       : DL(TM.createDataLayout()), IndirectStubsMgr(IndirectStubsMgrBuilder()),
-        CCMgr(std::move(CCMgr)), ObjectLayer(),
+        CCMgr(std::move(CCMgr)),
         CompileLayer(ObjectLayer, orc::SimpleCompiler(TM)),
         CODLayer(CompileLayer,
                  [](Function &F) { return std::set<Function *>({&F}); },
@@ -153,7 +172,7 @@ public:
           if (ExternalResolver)
             return JITSymbol(
                 ExternalResolver(Name.c_str(), ExternalResolverCtx),
-                llvm::JITSymbolFlags::Exported);
+                JITSymbolFlags::Exported);
 
           return JITSymbol(nullptr);
         },
@@ -167,7 +186,6 @@ public:
                             std::unique_ptr<RuntimeDyld::MemoryManager> MemMgr,
                             LLVMOrcSymbolResolverFn ExternalResolver,
                             void *ExternalResolverCtx) {
-
     // Attach a data-layout if one isn't already present.
     if (M->getDataLayout().isDefault())
       M->setDataLayout(DL);

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===---- OrcMCJITReplacement.h - Orc based MCJIT replacement ---*- C++ -*-===//
+//===- OrcMCJITReplacement.h - Orc based MCJIT replacement ------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -24,9 +24,12 @@
 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
 #include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
 #include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
+#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
 #include "llvm/ExecutionEngine/RuntimeDyld.h"
+#include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Mangler.h"
+#include "llvm/IR/Module.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Object/Binary.h"
 #include "llvm/Object/ObjectFile.h"
@@ -45,6 +48,9 @@
 #include <vector>
 
 namespace llvm {
+
+class ObjectCache;
+
 namespace orc {
 
 class OrcMCJITReplacement : public ExecutionEngine {
@@ -151,7 +157,6 @@ class OrcMCJITReplacement : public Execu
   };
 
 private:
-
   static ExecutionEngine *
   createOrcMCJITReplacement(std::string *ErrorMsg,
                             std::shared_ptr<MCJITMemoryManager> MemMgr,
@@ -162,10 +167,6 @@ private:
   }
 
 public:
-  static void Register() {
-    OrcMCJITReplacementCtor = createOrcMCJITReplacement;
-  }
-
   OrcMCJITReplacement(
       std::shared_ptr<MCJITMemoryManager> MemMgr,
       std::shared_ptr<JITSymbolResolver> ClientResolver,
@@ -178,8 +179,11 @@ public:
         CompileLayer(ObjectLayer, SimpleCompiler(*this->TM)),
         LazyEmitLayer(CompileLayer) {}
 
-  void addModule(std::unique_ptr<Module> M) override {
+  static void Register() {
+    OrcMCJITReplacementCtor = createOrcMCJITReplacement;
+  }
 
+  void addModule(std::unique_ptr<Module> M) override {
     // If this module doesn't have a DataLayout attached then attach the
     // default.
     if (M->getDataLayout().isDefault()) {
@@ -308,8 +312,8 @@ private:
 
   class NotifyObjectLoadedT {
   public:
-    typedef std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>
-        LoadedObjInfoListT;
+    using LoadedObjInfoListT =
+        std::vector<std::unique_ptr<RuntimeDyld::LoadedObjectInfo>>;
 
     NotifyObjectLoadedT(OrcMCJITReplacement &M) : M(M) {}
 
@@ -360,9 +364,9 @@ private:
     return MangledName;
   }
 
-  typedef RTDyldObjectLinkingLayer<NotifyObjectLoadedT> ObjectLayerT;
-  typedef IRCompileLayer<ObjectLayerT> CompileLayerT;
-  typedef LazyEmittingLayer<CompileLayerT> LazyEmitLayerT;
+  using ObjectLayerT = RTDyldObjectLinkingLayer<NotifyObjectLoadedT>;
+  using CompileLayerT = IRCompileLayer<ObjectLayerT>;
+  using LazyEmitLayerT = LazyEmittingLayer<CompileLayerT>;
 
   std::unique_ptr<TargetMachine> TM;
   MCJITReplacementMemMgr MemMgr;
@@ -380,7 +384,7 @@ private:
   // We need to store ObjLayerT::ObjSetHandles for each of the object sets
   // that have been emitted but not yet finalized so that we can forward the
   // mapSectionAddress calls appropriately.
-  typedef std::set<const void *> SectionAddrSet;
+  using SectionAddrSet = std::set<const void *>;
   struct ObjSetHandleCompare {
     bool operator()(ObjectLayerT::ObjSetHandleT H1,
                     ObjectLayerT::ObjSetHandleT H2) const {
@@ -395,6 +399,7 @@ private:
 };
 
 } // end namespace orc
+
 } // end namespace llvm
 
 #endif // LLVM_LIB_EXECUTIONENGINE_ORC_MCJITREPLACEMENT_H

Modified: llvm/trunk/tools/lli/OrcLazyJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.cpp?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/tools/lli/OrcLazyJIT.cpp (original)
+++ llvm/trunk/tools/lli/OrcLazyJIT.cpp Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===------ OrcLazyJIT.cpp - Basic Orc-based JIT for lazy execution -------===//
+//===- OrcLazyJIT.cpp - Basic Orc-based JIT for lazy execution ------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,45 +8,50 @@
 //===----------------------------------------------------------------------===//
 
 #include "OrcLazyJIT.h"
-#include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
-#include "llvm/Support/Debug.h"
+#include "llvm/ADT/Triple.h"
+#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/Support/CodeGen.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/DynamicLibrary.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FileSystem.h"
+#include <cstdint>
 #include <cstdio>
+#include <cstdlib>
 #include <system_error>
 
 using namespace llvm;
 
 namespace {
 
-  enum class DumpKind { NoDump, DumpFuncsToStdOut, DumpModsToStdOut,
-                        DumpModsToDisk };
-
-  cl::opt<DumpKind> OrcDumpKind("orc-lazy-debug",
-                                cl::desc("Debug dumping for the orc-lazy JIT."),
-                                cl::init(DumpKind::NoDump),
-                                cl::values(
-                                  clEnumValN(DumpKind::NoDump, "no-dump",
-                                             "Don't dump anything."),
-                                  clEnumValN(DumpKind::DumpFuncsToStdOut,
-                                             "funcs-to-stdout",
-                                             "Dump function names to stdout."),
-                                  clEnumValN(DumpKind::DumpModsToStdOut,
-                                             "mods-to-stdout",
-                                             "Dump modules to stdout."),
-                                  clEnumValN(DumpKind::DumpModsToDisk,
-                                             "mods-to-disk",
-                                             "Dump modules to the current "
-                                             "working directory. (WARNING: "
-                                             "will overwrite existing files).")),
-                                cl::Hidden);
-
-  cl::opt<bool> OrcInlineStubs("orc-lazy-inline-stubs",
-                               cl::desc("Try to inline stubs"),
-                               cl::init(true), cl::Hidden);
-}
+enum class DumpKind {
+  NoDump,
+  DumpFuncsToStdOut,
+  DumpModsToStdOut,
+  DumpModsToDisk
+};
+
+} // end anonymous namespace
+
+static cl::opt<DumpKind> OrcDumpKind(
+    "orc-lazy-debug", cl::desc("Debug dumping for the orc-lazy JIT."),
+    cl::init(DumpKind::NoDump),
+    cl::values(clEnumValN(DumpKind::NoDump, "no-dump", "Don't dump anything."),
+               clEnumValN(DumpKind::DumpFuncsToStdOut, "funcs-to-stdout",
+                          "Dump function names to stdout."),
+               clEnumValN(DumpKind::DumpModsToStdOut, "mods-to-stdout",
+                          "Dump modules to stdout."),
+               clEnumValN(DumpKind::DumpModsToDisk, "mods-to-disk",
+                          "Dump modules to the current "
+                          "working directory. (WARNING: "
+                          "will overwrite existing files).")),
+    cl::Hidden);
+
+static cl::opt<bool> OrcInlineStubs("orc-lazy-inline-stubs",
+                                    cl::desc("Try to inline stubs"),
+                                    cl::init(true), cl::Hidden);
 
 OrcLazyJIT::TransformFtor OrcLazyJIT::createDebugDumper() {
-
   switch (OrcDumpKind) {
   case DumpKind::NoDump:
     return [](std::unique_ptr<Module> M) { return M; };
@@ -98,7 +103,6 @@ OrcLazyJIT::TransformFtor OrcLazyJIT::cr
 // Defined in lli.cpp.
 CodeGenOpt::Level getOptLevel();
 
-
 template <typename PtrTy>
 static PtrTy fromTargetAddress(JITTargetAddress Addr) {
   return reinterpret_cast<PtrTy>(static_cast<uintptr_t>(Addr));
@@ -151,11 +155,10 @@ int llvm::runOrcLazyJIT(std::vector<std:
     return 1;
   }
 
-  typedef int (*MainFnPtr)(int, const char*[]);
+  using MainFnPtr = int (*)(int, const char*[]);
   std::vector<const char *> ArgV;
   for (auto &Arg : Args)
     ArgV.push_back(Arg.c_str());
   auto Main = fromTargetAddress<MainFnPtr>(MainSym.getAddress());
   return Main(ArgV.size(), (const char**)ArgV.data());
 }
-

Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=305760&r1=305759&r2=305760&view=diff
==============================================================================
--- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
+++ llvm/trunk/tools/lli/OrcLazyJIT.h Mon Jun 19 18:37:52 2017
@@ -1,4 +1,4 @@
-//===--- OrcLazyJIT.h - Basic Orc-based JIT for lazy execution --*- C++ -*-===//
+//===- OrcLazyJIT.h - Basic Orc-based JIT for lazy execution ----*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,38 +15,52 @@
 #ifndef LLVM_TOOLS_LLI_ORCLAZYJIT_H
 #define LLVM_TOOLS_LLI_ORCLAZYJIT_H
 
-#include "llvm/ADT/Triple.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
+#include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
 #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
+#include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
 #include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
+#include "llvm/IR/DataLayout.h"
+#include "llvm/IR/GlobalValue.h"
+#include "llvm/IR/Mangler.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetMachine.h"
+#include <algorithm>
+#include <functional>
+#include <memory>
+#include <set>
+#include <string>
+#include <vector>
 
 namespace llvm {
 
 class OrcLazyJIT {
 public:
-
-  typedef orc::JITCompileCallbackManager CompileCallbackMgr;
-  typedef orc::RTDyldObjectLinkingLayer<> ObjLayerT;
-  typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
-  typedef std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>
-    TransformFtor;
-  typedef orc::IRTransformLayer<CompileLayerT, TransformFtor> IRDumpLayerT;
-  typedef orc::CompileOnDemandLayer<IRDumpLayerT, CompileCallbackMgr> CODLayerT;
-  typedef CODLayerT::IndirectStubsManagerBuilderT
-    IndirectStubsManagerBuilder;
-  typedef CODLayerT::ModuleSetHandleT ModuleSetHandleT;
+  using CompileCallbackMgr = orc::JITCompileCallbackManager;
+  using ObjLayerT = orc::RTDyldObjectLinkingLayer<>;
+  using CompileLayerT = orc::IRCompileLayer<ObjLayerT>;
+  using TransformFtor =
+      std::function<std::unique_ptr<Module>(std::unique_ptr<Module>)>;
+  using IRDumpLayerT = orc::IRTransformLayer<CompileLayerT, TransformFtor>;
+  using CODLayerT = orc::CompileOnDemandLayer<IRDumpLayerT, CompileCallbackMgr>;
+  using IndirectStubsManagerBuilder = CODLayerT::IndirectStubsManagerBuilderT;
+  using ModuleSetHandleT = CODLayerT::ModuleSetHandleT;
 
   OrcLazyJIT(std::unique_ptr<TargetMachine> TM,
              std::unique_ptr<CompileCallbackMgr> CCMgr,
              IndirectStubsManagerBuilder IndirectStubsMgrBuilder,
              bool InlineStubs)
       : TM(std::move(TM)), DL(this->TM->createDataLayout()),
-	CCMgr(std::move(CCMgr)),
-	ObjectLayer(),
+        CCMgr(std::move(CCMgr)),
         CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
         IRDumpLayer(CompileLayer, createDebugDumper()),
         CODLayer(IRDumpLayer, extractSingleFunction, *this->CCMgr,
@@ -135,7 +149,6 @@ public:
   }
 
 private:
-
   std::string mangle(const std::string &Name) {
     std::string MangledName;
     {
@@ -172,4 +185,4 @@ int runOrcLazyJIT(std::vector<std::uniqu
 
 } // end namespace llvm
 
-#endif
+#endif // LLVM_TOOLS_LLI_ORCLAZYJIT_H




More information about the llvm-commits mailing list