Deallocation: Adds memory deallocation analysis functions#1052
Deallocation: Adds memory deallocation analysis functions#1052keremsahn wants to merge 1 commit into
Conversation
db84730 to
9c871a2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1052 +/- ##
==========================================
+ Coverage 86.62% 86.73% +0.10%
==========================================
Files 23 23
Lines 5946 6077 +131
==========================================
+ Hits 5151 5271 +120
- Misses 795 806 +11
🚀 New features to boost your workflow:
|
| struct DeallocationTraverser : RecursiveASTVisitor<DeallocationTraverser> { | ||
| std::unordered_map<const clang::VarDecl*, const clang::ParmVarDecl*> aliasMap; | ||
| std::set<const clang::ParmVarDecl*> overwritenParms; | ||
| std::vector<DeallocType>& VPP; |
There was a problem hiding this comment.
warning: no header providing "Cpp::DeallocType" is directly included [misc-include-cleaner]
nParms;
^| std::unordered_map<const clang::VarDecl*, const clang::ParmVarDecl*> aliasMap; | ||
| std::set<const clang::ParmVarDecl*> overwritenParms; | ||
| std::vector<DeallocType>& VPP; | ||
| DeallocationTraverser(std::vector<DeallocType>& v) : VPP(v) {} |
There was a problem hiding this comment.
warning: member 'VPP' of type 'std::vector &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]
>& VPP;
^|
|
||
| bool TraverseDecl(clang::Decl* D) { | ||
| if (D && llvm::isa<clang::TagDecl>(D)) | ||
| return true; |
There was a problem hiding this comment.
warning: isa_and_nonnull<> is preferred over an explicit test for null followed by calling isa<> [llvm-prefer-isa-or-dyn-cast-in-conditionals]
| return true; | |
| l* D) { | |
| cl>(D))isa_and_nonnullm::isa<clang::TagDecl>(D) |
| updateVPP(PVR->getFunctionScopeIndex(), DeallocType::Free); | ||
| } | ||
|
|
||
| bool shouldVisitLambdaBody() const { return false; } |
There was a problem hiding this comment.
warning: method 'shouldVisitLambdaBody' can be made static [readability-convert-member-functions-to-static]
| bool shouldVisitLambdaBody() const { return false; } | |
| );static |
| return; | ||
| } | ||
| DeallocationTraverser Traverser(valPerParam); | ||
| Traverser.TraverseStmt(const_cast<CompoundStmt*>(CmpStmt)); |
There was a problem hiding this comment.
warning: do not use const_cast to remove const qualifier [cppcoreguidelines-pro-type-const-cast]
Param);
^
FIXME 's and some other cases will be handled after I open issues.