Skip to content

Commit

Permalink
[BuildingAJIT] Clang-format chapters 1 and 2.
Browse files Browse the repository at this point in the history
llvm-svn: 346727
  • Loading branch information
lhames committed Nov 13, 2018
1 parent 575515f commit 8bf69be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions llvm/docs/tutorial/BuildingAJIT2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ Next we need to update our addModule method to replace the call to

.. code-block:: c++

ThreadSafeModule optimizeModule(ThreadSafeModule M,
const MaterializationResponsibility &R) {
static Expected<ThreadSafeModule>
optimizeModule(ThreadSafeModule M, const MaterializationResponsibility &R) {
// Create a function pass manager.
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(M.get());

Expand Down
7 changes: 3 additions & 4 deletions llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,8 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) {
if (auto E = ParseExpression()) {
// Make an anonymous proto.
auto Proto = llvm::make_unique<PrototypeAST>(("__anon_expr" +
Twine(ExprCount)).str(),
std::vector<std::string>());
auto Proto = llvm::make_unique<PrototypeAST>
("__anon_expr" + Twine(ExprCount)).str(), std::vector<std::string>());
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
}
return nullptr;
Expand Down Expand Up @@ -1157,7 +1156,7 @@ static void HandleTopLevelExpression() {

// Get the anonymous expression's JITSymbol.
auto Sym =
ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));

auto *FP = (double (*)())(intptr_t)Sym.getAddress();
assert(FP && "Failed to codegen function");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class KaleidoscopeJIT {
ThreadSafeContext Ctx;

public:

KaleidoscopeJIT(JITTargetMachineBuilder JTMB, DataLayout DL)
: ObjectLayer(ES,
[]() { return llvm::make_unique<SectionMemoryManager>(); }),
Expand Down Expand Up @@ -86,10 +85,8 @@ class KaleidoscopeJIT {
}

private:

static Expected<ThreadSafeModule>
optimizeModule(ThreadSafeModule TSM,
const MaterializationResponsibility &R) {
optimizeModule(ThreadSafeModule TSM, const MaterializationResponsibility &R) {
// Create a function pass manager.
auto FPM = llvm::make_unique<legacy::FunctionPassManager>(TSM.getModule());

Expand Down
7 changes: 3 additions & 4 deletions llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,8 @@ static std::unique_ptr<FunctionAST> ParseDefinition() {
static std::unique_ptr<FunctionAST> ParseTopLevelExpr(unsigned ExprCount) {
if (auto E = ParseExpression()) {
// Make an anonymous proto.
auto Proto = llvm::make_unique<PrototypeAST>(("__anon_expr" +
Twine(ExprCount)).str(),
std::vector<std::string>());
auto Proto = llvm::make_unique<PrototypeAST>
("__anon_expr" + Twine(ExprCount)).str(), std::vector<std::string>());
return llvm::make_unique<FunctionAST>(std::move(Proto), std::move(E));
}
return nullptr;
Expand Down Expand Up @@ -1157,7 +1156,7 @@ static void HandleTopLevelExpression() {

// Get the anonymous expression's JITSymbol.
auto Sym =
ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));
ExitOnErr(TheJIT->lookup(("__anon_expr" + Twine(ExprCount)).str()));

auto *FP = (double (*)())(intptr_t)Sym.getAddress();
assert(FP && "Failed to codegen function");
Expand Down

0 comments on commit 8bf69be

Please sign in to comment.