Skip to content

Commit e938da1

Browse files
committed
Make using directives global.
`llvm::Module` must remain qualified to resolve the ambiguity with `clang::Module`. Signed-off-by: Julian Oppermann <[email protected]>
1 parent 8961312 commit e938da1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

sycl-jit/jit-compiler/lib/rtc/DeviceCompilation.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
#include <clang/Tooling/CompilationDatabase.h>
1616
#include <clang/Tooling/Tooling.h>
1717

18+
using namespace clang;
19+
using namespace clang::tooling;
20+
using namespace clang::driver;
21+
using namespace llvm;
22+
1823
#ifdef _GNU_SOURCE
1924
#include <dlfcn.h>
2025
static char X; // Dummy symbol, used as an anchor for `dlinfo` below.
@@ -49,9 +54,6 @@ static const std::string &getDPCPPRoot() {
4954
}
5055

5156
namespace {
52-
using namespace clang;
53-
using namespace clang::tooling;
54-
using namespace clang::driver;
5557

5658
struct GetLLVMModuleAction : public ToolAction {
5759
// Code adapted from `FrontendActionFactory::runInvocation`.
@@ -96,23 +98,23 @@ struct GetLLVMModuleAction : public ToolAction {
9698

9799
} // anonymous namespace
98100

99-
llvm::Expected<std::unique_ptr<llvm::Module>>
101+
Expected<std::unique_ptr<llvm::Module>>
100102
jit_compiler::compileDeviceCode(InMemoryFile SourceFile,
101103
View<InMemoryFile> IncludeFiles,
102104
View<const char *> UserArgs) {
103105
const std::string &DPCPPRoot = getDPCPPRoot();
104106
if (DPCPPRoot == InvalidDPCPPRoot) {
105-
return llvm::createStringError("Could not locate DPCPP root directory");
107+
return createStringError("Could not locate DPCPP root directory");
106108
}
107109

108110
SmallVector<std::string> CommandLine = {"-fsycl-device-only"};
109111
// TODO: Allow instrumentation again when device library linking is
110112
// implemented.
111113
CommandLine.push_back("-fno-sycl-instrument-device-code");
112114
CommandLine.append(UserArgs.begin(), UserArgs.end());
113-
clang::tooling::FixedCompilationDatabase DB{".", CommandLine};
115+
FixedCompilationDatabase DB{".", CommandLine};
114116

115-
clang::tooling::ClangTool Tool{DB, {SourceFile.Path}};
117+
ClangTool Tool{DB, {SourceFile.Path}};
116118

117119
// Set up in-memory filesystem.
118120
Tool.mapVirtualFile(SourceFile.Path, SourceFile.Contents);
@@ -143,5 +145,5 @@ jit_compiler::compileDeviceCode(InMemoryFile SourceFile,
143145
}
144146

145147
// TODO: Capture compiler errors from the ClangTool.
146-
return llvm::createStringError("Unable to obtain LLVM module");
148+
return createStringError("Unable to obtain LLVM module");
147149
}

0 commit comments

Comments
 (0)