The document describes an approach to implement a diagnostic plugin in Clang to check that the return value from calls to malloc is not unused. The plugin uses a RecursiveASTVisitor to check each node for malloc calls, and whether the pointer is checked in any if statements or used elsewhere. If not checked, a warning is generated along with the location using the Diagnostic Engine. The team members working on this are listed.
The document describes an approach to implement a diagnostic plugin in Clang to check that the return value from calls to malloc is not unused. The plugin uses a RecursiveASTVisitor to check each node for malloc calls, and whether the pointer is checked in any if statements or used elsewhere. If not checked, a warning is generated along with the location using the Diagnostic Engine. The team members working on this are listed.
The document describes an approach to implement a diagnostic plugin in Clang to check that the return value from calls to malloc is not unused. The plugin uses a RecursiveASTVisitor to check each node for malloc calls, and whether the pointer is checked in any if statements or used elsewhere. If not checked, a warning is generated along with the location using the Diagnostic Engine. The team members working on this are listed.
The document describes an approach to implement a diagnostic plugin in Clang to check that the return value from calls to malloc is not unused. The plugin uses a RecursiveASTVisitor to check each node for malloc calls, and whether the pointer is checked in any if statements or used elsewhere. If not checked, a warning is generated along with the location using the Diagnostic Engine. The team members working on this are listed.
Download as PPTX, PDF, TXT or read online from Scribd
Download as pptx, pdf, or txt
You are on page 1of 2
DEPARTMENT OF COMPUTER SCIENCE
Clang diagnostic plugin to check the return value from a malloc.
Problem Statement Methodology Result/Conclusion
APPROACH Implement a diagnostic in Clang to identify unchecked use of the return value from ● RecursiveASTVisitor visits every node. calls to 'malloc'. For example, the code: ● First Malloc call is checked with VisitCallExpr. Then char *p = malloc(100); RASTV visits ifStmt. If the ptr is not checked in any if *p = 'x'; statements and the ptr is used somewhere, a warning is Must be diagnosed with a warning stating that ptr throw. must be checked. Introduction to CLANG/LLVM 1. Warning is generated using Diagnostic Engine. 2. Along with warning, Location is also LLVM is a set of libraries and tools, as well as a displayed standardized intermediate representation, that can be used to help build compilers and just-in-time compilers. Clang is a C/C++/Objective-C compiler, which uses Team Members its own frontend, and LLVM as the backend. The main objective of clang is to generate LLVM IR 1. Akshay RM (1RV20CS400) code for C/C++. 2. Bharath Kumar (1RV20CS401) Clang Plugins make it possible to run extra user 3. Jagadeesh Patil (1RV19CS062) defined actions during a compilation 4. Imran khan (1RV20CS405)