[llvm] [Kaleidoscope] Update tutorial ch2 to match example code document (PR #172392)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 15 16:47:08 PST 2025


https://github.com/Crivens6 updated https://github.com/llvm/llvm-project/pull/172392

>From 1bfef7dcef2ef63ca5d589c7121446a6256e2474 Mon Sep 17 00:00:00 2001
From: Christyllin <DiskworldWizzard at Gmail.com>
Date: Fri, 12 Dec 2025 17:44:04 -0800
Subject: [PATCH] [Kaleidoscope] Update tutorial ch2 to match example code
 document

auto Proto = std::make_unique<PrototypeAST>("",
std::vector<std::string>());
has been updated to
auto Proto = std::make_unique<PrototypeAST>("__anon_expr",
std::vector<std::string>());

This change syncs the tutorial with the example code document for
chapter 2. This is necessary to lookup the top level expression with the JIT
in chapter 4.
---
 llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
index ee12d983dd99e..eeb47a255a622 100644
--- a/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
+++ b/llvm/docs/tutorial/MyFirstLanguageFrontend/LangImpl02.rst
@@ -632,7 +632,7 @@ nullary (zero argument) functions for them:
     static std::unique_ptr<FunctionAST> ParseTopLevelExpr() {
       if (auto E = ParseExpression()) {
         // Make an anonymous proto.
-        auto Proto = std::make_unique<PrototypeAST>("", std::vector<std::string>());
+        auto Proto = std::make_unique<PrototypeAST>("__anon_expr", std::vector<std::string>());
         return std::make_unique<FunctionAST>(std::move(Proto), std::move(E));
       }
       return nullptr;



More information about the llvm-commits mailing list