Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Clang Diagnostic Plugin To Check The Return Value From A Malloc

Download as pptx, pdf, or txt
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)

You might also like