CppInsights 是一款基于 Clang 的源码转换工具,把编译器在幕后替你生成的代码用 C++ 原样展示出来,比如隐式生成的构造、拷贝、赋值函数,以及 lambda、范围 for、结构化绑定等语法糖的真实形态。适合想深入理解 C++ 语义的学习者和教学者。
核心亮点:
- 把编译器隐式生成的成员函数显式展示出来
- 还原 lambda、范围 for 等语法糖的真实写法
- 基于 Clang 做源码到源码转换,输出仍是 C++
- 支持在线试用与本地构建,便于教学演示
当前版本 v_23.1(2026-10-25 发布),开源协议 MIT,GitHub 4,690 star。
![]()
核心信息
| 软件名称 | Cppinsights(andreasfertig/cppinsights) |
| 当前版本 | v_23.1 |
| 更新日期 | 2026-10-25 |
| 开源协议 | MIT |
| 软件分类 | Linux 桌面 |
| 关键词 | ast、clang、cplusplus、cplusplus-11、cplusplus-14、cplusplus-17 |
本次更新内容
- 修复了协程转换中的多处问题,协程代码现在能正确生成并执行,不再出现提前继续或跳过关键步骤的情况。
- 解决了大量导致程序崩溃的问题,包括简单程序、微软代理库、结构化绑定配合 lambda 等场景,使用更稳定。
- 修正了类型转换与声明相关的错误,如常量变量缺少类型、有符号最小值转无符号、显式常量转换等,输出更准确。
- 修复了循环内变量声明、初始化列表、属性标注、移动专用 lambda 等场景生成无效代码的问题,转换结果更可靠。
- 完善了对类模板参数推导、变量模板特化、嵌套类、包展开等特性的支持,此前版本中这些代码可能无法正确转换。
查看官方英文更新日志(原文)
#### Bug Fixes:
- get_return_object is never called ([#728](https://github.com/andreasfertig/cppinsights/issues/728))
- co_await updates __suspend_index to late ([#727](https://github.com/andreasfertig/cppinsights/issues/727))
- execution continues after co_return ([#726](https://github.com/andreasfertig/cppinsights/issues/726))
- Missing type in the generated const var definition ([#723](https://github.com/andreasfertig/cppinsights/issues/723))
- Segmentation fault for a simple program ([#711](https://github.com/andreasfertig/cppinsights/issues/711))
- Insight output does not match input when casting signed MIN_SHORT to unsigned int ([#706](https://github.com/andreasfertig/cppinsights/issues/706))
- Incorrect vtable indexing in C++ to C transformation ([#701](https://github.com/andreasfertig/cppinsights/issues/701))
- Insight code missing ';' ([#682](https://github.com/andreasfertig/cppinsights/issues/682))
- Does not handle final_suspend properly in coroutine transformation ([#679](https://github.com/andreasfertig/cppinsights/issues/679))
- Generates incorrect code when variable is declared in the while loop parentheses ([#678](https://github.com/andreasfertig/cppinsights/issues/678))
- Segmentation fault trying to run Microsoft's proxy library ([#677](https://github.com/andreasfertig/cppinsights/issues/677))
- Segmentation fault with `noexcept( condition )` ([#654](https://github.com/andreasfertig/cppinsights/issues/654))
- std::initializer_list transformation produces invalid code ([#647](https://github.com/andreasfertig/cppinsights/issues/647))
- [[likely]] and [[unlikely]] delete condition bodies ([#644](https://github.com/andreasfertig/cppinsights/issues/644))
- structured binding with lambda reports 'Segmentation fault' ([#633](https://github.com/andreasfertig/cppinsights/issues/633))
- Segmentation Fault: Stack dump without symbol names ([#628](https://github.com/andreasfertig/cppinsights/issues/628))
- NRVO translation is not NRVO eligible ([#620](https://github.com/andreasfertig/cppinsights/issues/620))
- explicit casting for const ([#610](https://github.com/andreasfertig/cppinsights/issues/610))
- Superfluous parentheses in declarations are handled incorrectly ([#606](https://github.com/andreasfertig/cppinsights/issues/606))
- Incorrect move-only lambda code generation ([#605](https://github.com/andreasfertig/cppinsights/issues/605))
- Add support for `SourceLocExpr` ([#598](https://github.com/andreasfertig/cppinsights/issues/598))
- Class template argument deduction not working - cpp17 ([#596](https://github.com/andreasfertig/cppinsights/issues/596))
- Pack expansion in ctor call transformed into invalid c++ ([#595](https://github.com/andreasfertig/cppinsights/issues/595))
- Errors in transforming "int& a = A()" ([#593](https://github.com/andreasfertig/cppinsights/issues/593))
- Errors in transforming `struct T {} var` ([#588](https://github.com/andreasfertig/cppinsights/issues/588))
- Specialization of variable templates misses ty
下载地址
以下为官方原包,本站不二次打包,点击直接下载:
insights-ubuntu-amd64.tar.gz(官方原包 | 18.8 MB)
✅ 上方 SHA256 与官方发布值一致,可自行核对。
快速上手
- 解压下载好的压缩包,进入解压后的目录,找到可执行文件 insights
- 在终端中运行该可执行文件启动程序,首次启动后即可看到代码编辑界面
- 在编辑区粘贴或输入 C++ 源码,程序会实时展示编译器视角的转换结果
- 通过界面上的选项切换查看转换前后的代码,理解编译器在幕后所做的工作
提示:转换结果仅供学习参考,不保证与具体编译器输出完全一致
讨论(0 条)