Page MenuHomePhabricator

Fix traversal over CXXConstructExpr in Syntactic mode
Needs ReviewPublic

Authored by steveire on Jun 21 2020, 7:18 AM.

Details

Summary

Skip over elidable nodes, and ensure that intermediate
CXXFunctionalCastExpr nodes are also skipped if they are semantic.

Diff Detail

Event Timeline

steveire created this revision.Jun 21 2020, 7:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2020, 7:18 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman added inline comments.
clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
80

While I believe the change is necessary here, it's not obvious to me what "hints" tell me this behavior is correct for the given matchers. None of the matchers look like they're going to care about implicit nodes, so how am I to know that AsIs is correct or not as a reviewer? As it stands, I sort of feel like I have to take it on faith that this change is correct and it looks a little suspicious because the code using the matcher is creating a fix-it at what now may be the location of an implicit node.

clang/lib/AST/Expr.cpp
3001

Looks like the change introduced new curly braces for a single-line if.

clang/lib/AST/ParentMapContext.cpp
157

const auto *

Thanks for this fix!

clang/lib/AST/Expr.cpp
3001

Why is it necessary to check isElidable? I think the logic here is subtle (since the AST doesn't explicitly tag implicit expressions), so please add an explanatory comment.

clang/lib/AST/ParentMapContext.cpp
163

Same here. Please comment on the logic.