|
15 | 15 | #include <clang/Tooling/CompilationDatabase.h> |
16 | 16 | #include <clang/Tooling/Tooling.h> |
17 | 17 |
|
| 18 | +using namespace clang; |
| 19 | +using namespace clang::tooling; |
| 20 | +using namespace clang::driver; |
| 21 | +using namespace llvm; |
| 22 | + |
18 | 23 | #ifdef _GNU_SOURCE |
19 | 24 | #include <dlfcn.h> |
20 | 25 | static char X; // Dummy symbol, used as an anchor for `dlinfo` below. |
@@ -49,9 +54,6 @@ static const std::string &getDPCPPRoot() { |
49 | 54 | } |
50 | 55 |
|
51 | 56 | namespace { |
52 | | -using namespace clang; |
53 | | -using namespace clang::tooling; |
54 | | -using namespace clang::driver; |
55 | 57 |
|
56 | 58 | struct GetLLVMModuleAction : public ToolAction { |
57 | 59 | // Code adapted from `FrontendActionFactory::runInvocation`. |
@@ -96,23 +98,23 @@ struct GetLLVMModuleAction : public ToolAction { |
96 | 98 |
|
97 | 99 | } // anonymous namespace |
98 | 100 |
|
99 | | -llvm::Expected<std::unique_ptr<llvm::Module>> |
| 101 | +Expected<std::unique_ptr<llvm::Module>> |
100 | 102 | jit_compiler::compileDeviceCode(InMemoryFile SourceFile, |
101 | 103 | View<InMemoryFile> IncludeFiles, |
102 | 104 | View<const char *> UserArgs) { |
103 | 105 | const std::string &DPCPPRoot = getDPCPPRoot(); |
104 | 106 | if (DPCPPRoot == InvalidDPCPPRoot) { |
105 | | - return llvm::createStringError("Could not locate DPCPP root directory"); |
| 107 | + return createStringError("Could not locate DPCPP root directory"); |
106 | 108 | } |
107 | 109 |
|
108 | 110 | SmallVector<std::string> CommandLine = {"-fsycl-device-only"}; |
109 | 111 | // TODO: Allow instrumentation again when device library linking is |
110 | 112 | // implemented. |
111 | 113 | CommandLine.push_back("-fno-sycl-instrument-device-code"); |
112 | 114 | CommandLine.append(UserArgs.begin(), UserArgs.end()); |
113 | | - clang::tooling::FixedCompilationDatabase DB{".", CommandLine}; |
| 115 | + FixedCompilationDatabase DB{".", CommandLine}; |
114 | 116 |
|
115 | | - clang::tooling::ClangTool Tool{DB, {SourceFile.Path}}; |
| 117 | + ClangTool Tool{DB, {SourceFile.Path}}; |
116 | 118 |
|
117 | 119 | // Set up in-memory filesystem. |
118 | 120 | Tool.mapVirtualFile(SourceFile.Path, SourceFile.Contents); |
@@ -143,5 +145,5 @@ jit_compiler::compileDeviceCode(InMemoryFile SourceFile, |
143 | 145 | } |
144 | 146 |
|
145 | 147 | // TODO: Capture compiler errors from the ClangTool. |
146 | | - return llvm::createStringError("Unable to obtain LLVM module"); |
| 148 | + return createStringError("Unable to obtain LLVM module"); |
147 | 149 | } |
0 commit comments