Skip to content

Commit 0a59db8

Browse files
committed
Address comments
1 parent 4434cee commit 0a59db8

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

clang/lib/Interpreter/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ add_clang_library(clangInterpreter
2020
Interpreter.cpp
2121
InterpreterUtils.cpp
2222
Value.cpp
23-
WASM.cpp
23+
Wasm.cpp
2424

2525
DEPENDS
2626
intrinsics_gen

clang/lib/Interpreter/Interpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "IncrementalExecutor.h"
1616
#include "IncrementalParser.h"
1717
#include "InterpreterUtils.h"
18-
#include "WASM.h"
18+
#include "Wasm.h"
1919

2020
#include "clang/AST/ASTContext.h"
2121
#include "clang/AST/Mangle.h"
@@ -408,7 +408,7 @@ llvm::Error Interpreter::CreateExecutor() {
408408
return JB.takeError();
409409
llvm::Error Err = llvm::Error::success();
410410
#ifdef __EMSCRIPTEN__
411-
auto Executor = std::make_unique<WASMIncrementalExecutor>(*TSCtx, **JB, Err);
411+
auto Executor = std::make_unique<WasmIncrementalExecutor>(*TSCtx, **JB, Err);
412412
#else
413413
auto Executor = std::make_unique<IncrementalExecutor>(*TSCtx, **JB, Err);
414414
#endif

clang/lib/Interpreter/WASM.cpp renamed to clang/lib/Interpreter/Wasm.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===----------------- WASM.cpp - WASM Interpreter --------------*- C++ -*-===//
1+
//===----------------- Wasm.cpp - Wasm Interpreter --------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,7 +10,9 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "WASM.h"
13+
#ifdef __EMSCRIPTEN__
14+
15+
#include "Wasm.h"
1416
#include "IncrementalExecutor.h"
1517

1618
#include <llvm/IR/LegacyPassManager.h>
@@ -24,19 +26,19 @@
2426

2527
namespace clang {
2628

27-
WASMIncrementalExecutor::WASMIncrementalExecutor(
29+
WasmIncrementalExecutor::WasmIncrementalExecutor(
2830
llvm::orc::ThreadSafeContext &TSC)
2931
: IncrementalExecutor(TSC) {}
3032

31-
llvm::Error WASMIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
33+
llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
3234
PTU.TheModule->dump();
3335

3436
std::string ErrorString;
3537

3638
const llvm::Target *Target = llvm::TargetRegistry::lookupTarget(
3739
PTU.TheModule->getTargetTriple(), ErrorString);
3840
if (!Target) {
39-
return llvm::make_error<llvm::StringError>("Failed to create WASM Target: ",
41+
return llvm::make_error<llvm::StringError>("Failed to create Wasm Target: ",
4042
llvm::inconvertibleErrorCode());
4143
}
4244

@@ -53,12 +55,12 @@ llvm::Error WASMIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
5355
if (TargetMachine->addPassesToEmitFile(PM, OutputFile, nullptr,
5456
llvm::CGFT_ObjectFile)) {
5557
return llvm::make_error<llvm::StringError>(
56-
"WASM backend cannot produce object.", llvm::inconvertibleErrorCode());
58+
"Wasm backend cannot produce object.", llvm::inconvertibleErrorCode());
5759
}
5860

5961
if (!PM.run(*PTU.TheModule)) {
6062

61-
return llvm::make_error<llvm::StringError>("Failed to emit WASM object.",
63+
return llvm::make_error<llvm::StringError>("Failed to emit Wasm object.",
6264
llvm::inconvertibleErrorCode());
6365
}
6466

@@ -92,16 +94,18 @@ llvm::Error WASMIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
9294
return llvm::Error::success();
9395
}
9496

95-
llvm::Error WASMIncrementalExecutor::removeModule(PartialTranslationUnit &PTU) {
97+
llvm::Error WasmIncrementalExecutor::removeModule(PartialTranslationUnit &PTU) {
9698
return llvm::make_error<llvm::StringError>("Not implemented yet",
9799
llvm::inconvertibleErrorCode());
98100
}
99101

100-
llvm::Error WASMIncrementalExecutor::runCtors() const {
102+
llvm::Error WasmIncrementalExecutor::runCtors() const {
101103
// This seems to be automatically done when using dlopen()
102104
return llvm::Error::success();
103105
}
104106

105-
WASMIncrementalExecutor::~WASMIncrementalExecutor() = default;
107+
WasmIncrementalExecutor::~WasmIncrementalExecutor() = default;
106108

107109
} // namespace clang
110+
111+
#endif // __EMSCRIPTEN__

clang/lib/Interpreter/WASM.h renamed to clang/lib/Interpreter/Wasm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===------------------ WASM.h - WASM Interpreter ---------------*- C++ -*-===//
1+
//===------------------ Wasm.h - Wasm Interpreter ---------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -17,15 +17,15 @@
1717

1818
namespace clang {
1919

20-
class WASMIncrementalExecutor : public IncrementalExecutor {
20+
class WasmIncrementalExecutor : public IncrementalExecutor {
2121
public:
22-
WASMIncrementalExecutor(llvm::orc::ThreadSafeContext &TSC);
22+
WasmIncrementalExecutor(llvm::orc::ThreadSafeContext &TSC);
2323

2424
llvm::Error addModule(PartialTranslationUnit &PTU) override;
2525
llvm::Error removeModule(PartialTranslationUnit &PTU) override;
2626
llvm::Error runCtors() const override;
2727

28-
~WASMIncrementalExecutor() override;
28+
~WasmIncrementalExecutor() override;
2929
};
3030

3131
} // namespace clang

0 commit comments

Comments
 (0)