本技能介绍如何使用命令行`gh`只读查看GitHub issue正文和评论,支持通过编号或URL定位,也可指定其他仓库,并说明如何提取大量评论。
- 查看issue正文和评论
- 通过URL读取issue
- 查看其他仓库的issue
本技能介绍 Carbon 编译器工具链的结构与处理阶段,并说明如何构建、测试和调试,以及如何遵循实现约定、处理诊断信息和更新测试预期输出。
Instructions for checking, building, debugging, and understanding the Carbon toolchain.
实测评分 未实测
查看安装方法本技能介绍 Carbon 编译器工具链的结构,以及词法分析、语法分析、语义检查和降级为 LLVM IR 等处理阶段。它会指引你查找相关目录、定义文件和处理器,并说明修改代码时应遵循的约定。内容还包括使用 bazelisk 构建和运行测试、调试失败、处理诊断与错误,以及使用专用脚本更新测试预期输出。
开始修改 Carbon 工具链,或需要定位已有实现并了解其所属阶段时,可以参考本技能。它也适用于确认测试运行方式、调查程序崩溃,以及了解项目如何使用 LLVM API 和现有数据结构。语言服务器和内置函数等领域则有各自单独的指导。
这些指导面向 Carbon 工具链。构建和测试使用 bazelisk,更新测试输出使用 ./toolchain/autoupdate_testdata.py。语言服务器、诊断信息和内置函数相关工作请参考对应的独立技能。
本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。
AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。
不计入评分。 由 AI(OpenAI Codex)于 2026年10月26日 评估。仅供参考,安装前请同时查看原文。
安装前可以查看交给 AI 代理的指令内容。
toolchain/:
toolchain/docs for detailed
architecture design and patterns.
ValueStore, formatting
.def files, struct reflection) used throughout the implementation."int.convert_float").toolchain/language_server/ or utils/vscode/. Neither follows the
patterns described here..def files and expanded by way of macros.Handle<StateName> in parse/handle_*.cpp.HandleParseNode in check/handle_*.cpp.HandleInst in lower/handle_*.cpp.bazelisk test //...bazelisk test //toolchain/testing:file_testbazelisk test //toolchain/testing:file_test --test_arg=--file_tests=<path_to_carbon_file>bazelisk build //toolchain/...Carbon tests often use file_test (for example,
//toolchain/testing/file_test). For detailed guidelines on authoring tests,
including file splits, naming conventions (fail_, todo_), and generating
minimal output with SemIR dumps, please refer to the Toolchain tests skill.
If you change compiler behavior, you likely need to update expected test outputs. Do not manually edit thousands of lines of expected output. Use the script:
./toolchain/autoupdate_testdata.py
# Or for a specific file:
./toolchain/autoupdate_testdata.py toolchain/check/testdata/my_test.carbon
llvm::errs() << "debug info\n";.
std::cout (it may interfere with tool output).Print method or operator<<.inst.Print(llvm::errs())--sandbox_debug if needed,
but often running the binary directly from bazel-bin/ is easier for
debugging.ErrorOr<T>: Return ErrorOr<T> for fallible operations.
if (auto result = Function(); result) { Use(*result); }llvm::Expected<T>: Similar to ErrorOr, used when interfacing with
LLVM.When declaring and emitting errors, ensure semantic wording matches the exact context:
IntLiteral or FloatLiteral. For example, use
RealLiteralTooLargeForUnsizedInt instead of a diagnostic referencing an
"integer type".MaxIntWidth) to align message structures and parameter expectations.llvm::cast<T>(obj) (checked, asserts on failure).llvm::dyn_cast<T>(obj) (returns null on failure).llvm::isa<T>(obj) (boolean check).dynamic_cast and standard RTTI.Before implementing custom algorithms for mathematical, logical, or bitwise operations, inspect target LLVM ADT class APIs:
APInt, APFloat, or
APSInt) already offer native equivalents (for example, .pow(),
ilogb(), .changeSign(), convertFromAPInt()). Avoid duplicate, naive,
or inefficient custom loops.common/ and toolchain/base/ over LLVM ADTs. For example,
use Map instead of llvm::DenseMap.llvm::SmallVector, llvm::StringRef).StringRef is a view; be careful with lifetimes.explorer references: The explorer prototype has been moved.
Ignore references to it in proposals or old docs; focus on toolchain.autoupdate_testdata.py
can do it for you.std::string unnecessarily: Prefer llvm::StringRef for
arguments.clang-format).clangd diagnostics: In-editor diagnostics are only as
good as compile_commands.json. If it predates a newly added file, clangd
falls back to a default command and reports nonsense, such as missing
standard headers or "no member named None". Regenerate it with
./scripts/create_compdb.py, which only takes a few seconds.还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
本技能介绍如何使用命令行`gh`只读查看GitHub issue正文和评论,支持通过编号或URL定位,也可指定其他仓库,并说明如何提取大量评论。
本技能为在 Carbon 代码库中工作的 AI 助手规定文件查看、搜索和编辑工具,并说明临时文件的存放与清理规则,以及何时可以编写和运行自定义程序。
了解如何在 Carbon 项目中通过 Bazelisk 构建、测试和运行程序,包括指定目标、启用 ASan,以及系统依赖变更后重建缓存。
本技能介绍如何为Carbon编译器添加内置函数,包括类型注册、签名验证、常量求值、运行时LLVM IR生成、Prelude绑定,以及使用最小Prelude编写针对性测试。
了解 Carbon 工具链对 Bazel、C++、Carbon、Markdown 和 Python 文件的格式规范,并查看注释、文档、命名、设计及提交说明的写作要求。
本技能介绍如何在Carbon工具链中添加或修改错误和警告,包括注册诊断类型、用带类型的参数构造消息、为源码位置添加标签和上下文,以及检查措辞规范和测试覆盖。