llvm.org GIT mirror llvm / f9ebd61
[Examples] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303944 91177308-0d34-0410-b5e6-96231b3b80d8 Eugene Zelenko 2 years ago
7 changed file(s) with 43 addition(s) and 44 deletion(s). Raw diff Collapse all Expand all
None //===----- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope ----*- C++ -*-===//
0 //===- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope --------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1616 #include "llvm/ADT/STLExtras.h"
1717 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1818 #include "llvm/ExecutionEngine/JITSymbol.h"
19 #include "llvm/ExecutionEngine/RuntimeDyld.h"
19 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
2020 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
2121 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
2222 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
4343 IRCompileLayer CompileLayer;
4444
4545 public:
46 typedef decltype(CompileLayer)::ModuleSetHandleT ModuleHandle;
46 using ModuleHandle = decltype(CompileLayer)::ModuleSetHandleT;
4747
4848 KaleidoscopeJIT()
4949 : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
None //===----- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope ----*- C++ -*-===//
0 //===- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope --------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1616 #include "llvm/ADT/STLExtras.h"
1717 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1818 #include "llvm/ExecutionEngine/JITSymbol.h"
19 #include "llvm/ExecutionEngine/RuntimeDyld.h"
19 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
2020 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
2121 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
2222 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
4646 RTDyldObjectLinkingLayer<> ObjectLayer;
4747 IRCompileLayer CompileLayer;
4848
49 typedef std::function(std::unique_ptr)>
50 OptimizeFunction;
49 using OptimizeFunction =
50 std::function(std::unique_ptr)>;
5151
5252 IRTransformLayer OptimizeLayer;
5353
5454 public:
55 typedef decltype(OptimizeLayer)::ModuleSetHandleT ModuleHandle;
55 using ModuleHandle = decltype(OptimizeLayer)::ModuleSetHandleT;
5656
5757 KaleidoscopeJIT()
5858 : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
None //===----- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope ----*- C++ -*-===//
0 //===- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope --------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1616 #include "llvm/ADT/STLExtras.h"
1717 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1818 #include "llvm/ExecutionEngine/JITSymbol.h"
19 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
1920 #include "llvm/ExecutionEngine/RuntimeDyld.h"
2021 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
2122 #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
4849 RTDyldObjectLinkingLayer<> ObjectLayer;
4950 IRCompileLayer CompileLayer;
5051
51 typedef std::function(std::unique_ptr)>
52 OptimizeFunction;
52 using OptimizeFunction =
53 std::function(std::unique_ptr)>;
5354
5455 IRTransformLayer OptimizeLayer;
5556
5758 CompileOnDemandLayer CODLayer;
5859
5960 public:
60 typedef decltype(CODLayer)::ModuleSetHandleT ModuleHandle;
61 using ModuleHandle = decltype(CODLayer)::ModuleSetHandleT;
6162
6263 KaleidoscopeJIT()
6364 : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),
None //===----- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope ----*- C++ -*-===//
0 //===- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope --------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1616 #include "llvm/ADT/STLExtras.h"
1717 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1818 #include "llvm/ExecutionEngine/JITSymbol.h"
19 #include "llvm/ExecutionEngine/RuntimeDyld.h"
19 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
2020 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
21 #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
2221 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
22 #include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
2323 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
2424 #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
2525 #include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
7575 RTDyldObjectLinkingLayer<> ObjectLayer;
7676 IRCompileLayer CompileLayer;
7777
78 typedef std::function(std::unique_ptr)>
79 OptimizeFunction;
78 using OptimizeFunction =
79 std::function(std::unique_ptr)>;
8080
8181 IRTransformLayer OptimizeLayer;
8282
8484 std::unique_ptr IndirectStubsMgr;
8585
8686 public:
87 typedef decltype(OptimizeLayer)::ModuleSetHandleT ModuleHandle;
87 using ModuleHandle = decltype(OptimizeLayer)::ModuleSetHandleT;
8888
8989 KaleidoscopeJIT()
9090 : TM(EngineBuilder().selectTarget()),
105105 TargetMachine &getTargetMachine() { return *TM; }
106106
107107 ModuleHandle addModule(std::unique_ptr M) {
108
109108 // Build our symbol resolver:
110109 // Lambda 1: Look back into the JIT itself to find symbols that are part of
111110 // the same "logical dylib".
None //===----- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope ----*- C++ -*-===//
0 //===- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope --------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1919 #include "llvm/ADT/Triple.h"
2020 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2121 #include "llvm/ExecutionEngine/JITSymbol.h"
22 #include "llvm/ExecutionEngine/RuntimeDyld.h"
23 #include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
2422 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
23 #include "llvm/ExecutionEngine/Orc/IndirectionUtils.h"
2524 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
2625 #include "llvm/ExecutionEngine/Orc/IRTransformLayer.h"
2726 #include "llvm/ExecutionEngine/Orc/LambdaResolver.h"
7271 namespace orc {
7372
7473 // Typedef the remote-client API.
75 typedef remote::OrcRemoteTargetClient MyRemote;
74 using MyRemote = remote::OrcRemoteTargetClient;
7675
7776 class KaleidoscopeJIT {
7877 private:
8180 RTDyldObjectLinkingLayer<> ObjectLayer;
8281 IRCompileLayer CompileLayer;
8382
84 typedef std::function(std::unique_ptr)>
85 OptimizeFunction;
83 using OptimizeFunction =
84 std::function(std::unique_ptr)>;
8685
8786 IRTransformLayer OptimizeLayer;
8887
9190 MyRemote &Remote;
9291
9392 public:
94 typedef decltype(OptimizeLayer)::ModuleSetHandleT ModuleHandle;
93 using ModuleHandle = decltype(OptimizeLayer)::ModuleSetHandleT;
9594
9695 KaleidoscopeJIT(MyRemote &Remote)
9796 : TM(EngineBuilder().selectTarget(Triple(Remote.getTargetTriple()), "",
123122 TargetMachine &getTargetMachine() { return *TM; }
124123
125124 ModuleHandle addModule(std::unique_ptr M) {
126
127125 // Build our symbol resolver:
128126 // Lambda 1: Look back into the JIT itself to find symbols that are part of
129127 // the same "logical dylib".
0 #include "../RemoteJITUtils.h"
1 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
2 #include "llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h"
3 #include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
4 #include "llvm/Support/CommandLine.h"
15 #include "llvm/Support/DynamicLibrary.h"
6 #include "llvm/Support/Error.h"
7 #include "llvm/Support/raw_ostream.h"
28 #include "llvm/Support/TargetSelect.h"
3 #include "llvm/ExecutionEngine/Orc/OrcRemoteTargetServer.h"
4 #include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
5
6 #include "../RemoteJITUtils.h"
7
9 #include
10 #include
811 #include
9 #include <unistd.h>
12 #include <string>
1013 #include
1114 #include
12
1315
1416 using namespace llvm;
1517 using namespace llvm::orc;
2123
2224 ExitOnError ExitOnErr;
2325
24 typedef int (*MainFun)(int, const char*[]);
26 using MainFun = int (*)(int, const char*[]);
2527
2628 template
2729 NativePtrT MakeNative(uint64_t P) {
3537
3638 // --- LAZY COMPILE TEST ---
3739 int main(int argc, char* argv[]) {
38
3940 if (argc == 0)
4041 ExitOnErr.setBanner("jit_server: ");
4142 else
5859 int sockfd = socket(PF_INET, SOCK_STREAM, 0);
5960 sockaddr_in servAddr, clientAddr;
6061 socklen_t clientAddrLen = sizeof(clientAddr);
61 bzero(&servAddr, sizeof(servAddr));
62 memset(&servAddr, 0, sizeof(servAddr));
6263 servAddr.sin_family = PF_INET;
6364 servAddr.sin_family = INADDR_ANY;
6465 servAddr.sin_port = htons(Port);
6566
6667 {
6768 // avoid "Address already in use" error.
68 int yes=1;
69 int yes = 1;
6970 if (setsockopt(sockfd,SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1) {
7071 errs() << "Error calling setsockopt.\n";
7172 return 1;
9798 };
9899
99100 FDRPCChannel TCPChannel(newsockfd, newsockfd);
100 typedef remote::OrcRemoteTargetServer MyServerT;
101
102 using MyServerT = remote::OrcRemoteTargetServer;
101103
102104 MyServerT Server(TCPChannel, SymbolLookup, RegisterEHFrames, DeregisterEHFrames);
103105
None //===----- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope ----*- C++ -*-===//
0 //===- KaleidoscopeJIT.h - A simple JIT for Kaleidoscope --------*- C++ -*-===//
11 //
22 // The LLVM Compiler Infrastructure
33 //
1818 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1919 #include "llvm/ExecutionEngine/JITSymbol.h"
2020 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
21 #include "llvm/ExecutionEngine/RuntimeDyld.h"
2221 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
2322 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
2423 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
3938
4039 class KaleidoscopeJIT {
4140 public:
42 typedef RTDyldObjectLinkingLayer<> ObjLayerT;
43 typedef IRCompileLayer CompileLayerT;
44 typedef CompileLayerT::ModuleSetHandleT ModuleHandleT;
41 using ObjLayerT = RTDyldObjectLinkingLayer<>;
42 using CompileLayerT = IRCompileLayer;
43 using ModuleHandleT = CompileLayerT::ModuleSetHandleT;
4544
4645 KaleidoscopeJIT()
4746 : TM(EngineBuilder().selectTarget()), DL(TM->createDataLayout()),