Issue |
141154
|
Summary |
clangd needs a feature to build reduced context as input to large language model prompts
|
Labels |
new issue
|
Assignees |
|
Reporter |
bartlettroscoe
|
## Description
A feature that is badly needed for the application of AL models for C++ code is the ability to build a reduced context for large C++ code bases where only a minimal context is extracted and used to generate a prompt for a large language model (LLM). The problem is that the large C++ code bases can't fit in the prompt for even the best LLM models and providing extra C++ code that does not provide context just confuses the LLM and degrades performance. What is needed is a tool where you can point to selections of C++ "code of interest" (e.g., some functions, classes, or just few lines of C++ code), and then goes off and recursively looks up all of the classes, functions, variables, etc. that are used in that "code of interest" and produces a listing of C++ code as context with just those upstream dependencies. What this does is to basically take a very large C++ project and turn it into a smaller C++ project (at least for what the LLM needs to know).
The need for this is type of context gathering is described in the paper:
* "YABLoCo: Yet Another Benchmark for Long Context Code Generation", submitted 5/7/2025, https://arxiv.org/abs/2505.04406v1
The basic outline of such a tool based on LLVM is described in the paper:
* "CITYWALK: Enhancing LLM-Based C++ Unit Test Generation via Project-Dependency Awareness and Language-Specific Knowledge", submitted 1/27/2025, https://arxiv.org/abs/2501.16155
The clangd tool already does indexing of a large C++ project and has access to all of the source code (and the AST if needed). The clangd tool would seem like the logical place to add such a recursive context lookup for a large C++ project. This, together with integration with the (VSCode) Continue.dev extension, this would provide a seamless way to provide the context needed to pass to the prompt of the LLM so that it has a shot at fully understanding a selection of C++ code (so it can explain, refactor, or add unit tests for the code of interest).
Clande 4.0 suggests this is what you need to do:
* https://claude.ai/share/58749dfb-3fdf-4379-8512-f49068bfc335
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs