Repository navigation
Support function try-catch blocks in AnalyzeAllocType and AnalyzeDeallocType - #1186
Open
sumitsaraswat362 wants to merge 3 commits into
Open
sumitsaraswat362 wants to merge 3 commits into
sumitsaraswat362 wants to merge 3 commits into
Conversation
…locType Traverse function body statements directly instead of requiring a CompoundStmt, allowing function-level try-catch blocks to be properly analyzed for allocation and deallocation.
| for (auto* parm : Fn->parameters()) | ||
| Traverser.VisitVarDecl(parm); | ||
| Traverser.TraverseStmt(const_cast<clang::CompoundStmt*>(CmpStmt)); | ||
| Traverser.TraverseStmt(const_cast<clang::Stmt*>(fnBody)); |
Contributor
There was a problem hiding this comment.
warning: do not use const_cast to remove const qualifier [cppcoreguidelines-pro-type-const-cast]
VisitVarDecl(parm);
^| valPerParam.assign(numParam, DeallocType::None); | ||
| DeallocationTraverser Traverser(valPerParam, visitedFuncs); | ||
| Traverser.TraverseStmt(const_cast<CompoundStmt*>(CmpStmt)); | ||
| Traverser.TraverseStmt(const_cast<Stmt*>(S)); |
Contributor
There was a problem hiding this comment.
warning: do not use const_cast to remove const qualifier [cppcoreguidelines-pro-type-const-cast]
ram, visitedFuncs);
^
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1186 +/- ##
==========================================
- Coverage 88.86% 88.85% -0.02%
==========================================
Files 24 24
Lines 7014 7006 -8
==========================================
- Hits 6233 6225 -8
Misses 781 781
🚀 New features to boost your workflow:
|
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Traverse function body statements directly instead of requiring a CompoundStmt, allowing function-level try-catch blocks to be properly analyzed for allocation and deallocation behavior.
Fixes #1061
Type of change
Testing
Updated existing func16 test in unittests/CppInterOp/FunctionReflectionTest.cpp to expect New instead of Unknown, and added func46 to verify deallocation within a function try-block.
Checklist