-
Notifications
You must be signed in to change notification settings - Fork 0
Research
All identified snippets of research done during the project.
Found that since a while ago, LLVM removed their cpp backend to translate IR back into cpp source. A not up-to date version could be used for the project, but the commit itself mentions that the backend wasn't generating correct code since even further ago. Therefore IR could be used for analysis, but would not be useful for the scope of this project as it could not be transformed back into source code
Escape Analysis & Capture Tracking in LLVM (ref)
Pointer Capture: A pointer value is captured if the function makes a copy of any part of the pointer that outlives the call.
Pointer Escape: A pointer value escapes if it is is accessible from outside the current function or thread. The latter case is sometimes considered separate and called thread-escape
Although the names seem to suggest that these two are opposites, it should be clear from their definition that they are not. Informally, escaping is concerned with the contents of the pointer, while capturing is concerned with the pointer itself.
In languages like C and C++, a pointer that escapes is always captured because there is no way to refer to an object without being able to determine its address. The opposite doesn't hold: a pointer can be captured without escaping.
LLVM Capture Tracking (header)
This is implemented for LLVM IR, rather than C++ AST specifically. The algorithm isn't large, so could be translated, or the IR and AST could be used cooperatively.