arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2601.14936cs.SE
收藏

基于大型语言模型的C++隐式数据丢失编译警告修复:一个工业案例研究

LLM-Based Repair of C++ Implicit Data Loss Compiler Warnings: An Industrial Case Study

SAP Labs Korea(SAP韩国实验室)

Chansong You, Hyun Deok Choi, Jingun Hong

AI总结:

本文提出利用LLM修复C++隐式数据丢失警告的方法,通过工业案例验证其有效性,减少人工干预并提升代码质量。

摘要:

本文提出了一种利用大型语言模型(LLMs)自动修复大型C++项目中隐式数据丢失警告的方法。我们的方法使用语言服务器协议(LSP)收集上下文,Tree-sitter提取相关代码,并利用LLMs进行决策和生成修复。该方法评估了范围检查的必要性及其对性能的影响,并生成适当的修复。我们在一个大型C++项目中测试了该方法,结果表明人类开发者在代码审查中接受修复的比率达到了92.73%。我们的LLM生成的修复将由于范围检查和异常处理而引入额外指令的警告修复更改数量减少了39.09%,相比基线修复策略。这一结果比由人类开发者创建的最优解决方案低了13.56%。这些发现表明,我们的基于LLM的方法可以减少处理编译警告的人工努力,同时在真实场景中保持代码质量和性能。我们的自动化方法显示出在现有开发流程中集成的潜力,可能改善复杂C++软件项目的代码维护实践。

英文摘要:

This paper presents a method to automatically fix implicit data loss warnings in large C++ projects using Large Language Models (LLMs). Our approach uses the Language Server Protocol (LSP) to gather context, Tree-sitter to extract relevant code, and LLMs to make decisions and generate fixes. The method evaluates the necessity of range checks concerning performance implications and generates appropriate fixes. We tested this method in a large C++ project, resulting in a 92.73% acceptance rate of the fixes by human developers during the code review. Our LLM-generated fixes reduced the number of warning fix changes that introduced additional instructions due to range checks and exception handling by 39.09% compared to a baseline fix strategy. This result was 13.56% behind the optimal solutions created by human developers. These findings demonstrate that our LLM-based approach can reduce the manual effort to address compiler warnings while maintaining code quality and performance in a real-world scenario. Our automated approach shows promise for integration into existing development workflows, potentially improving code maintenance practices in complex C++ software projects.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑