This revision was not accepted when it landed; it landed in state "Needs
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rC336995: [analyzer][UninitializedObjectChecker] Fixed
captured lambda variable name (authored by Szelethus, committed by
Szelethus updated this revision to Diff 155361.
Szelethus marked an inline comment as done.
Szelethus added a comment.
Thanks! :)
Rebased to https://reviews.llvm.org/rC336994.
https://reviews.llvm.org/D48291
Files:
lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp
NoQ accepted this revision.
NoQ added a comment.
Looks good!
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:691
+StringRef getVariableName(const FieldDecl *Field) {
+ // If \p Field is a captured lambda variable, Field->getName() will return
Szelethus marked 3 inline comments as done.
Szelethus added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:691
+StringRef getVariableName(const FieldDecl *Field) {
+ // If \p Field is a captured lambda variable, Field->getName() will
Szelethus updated this revision to Diff 154420.
Szelethus added a comment.
Finding the correct captured variable now works with
`FieldDecl::getFieldIndex()`.
https://reviews.llvm.org/D48291
Files:
lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp
george.karpenkov requested changes to this revision.
george.karpenkov added a comment.
This revision now requires changes to proceed.
Looks like @NoQ had some valid comments as well.
https://reviews.llvm.org/D48291
___
cfe-commits mailing list
george.karpenkov added a comment.
Few more nits.
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:691
+StringRef getVariableName(const FieldDecl *Field) {
+ // If \p Field is a captured lambda variable, Field->getName() will return
Is
NoQ added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:699
+for (const LambdaCapture : CXXParent->captures()) {
+ if (L.getLocation() == Field->getLocation())
+return L.getCapturedVar()->getName();
Szelethus updated this revision to Diff 152105.
Szelethus added a comment.
Fixes according to inline comments.
https://reviews.llvm.org/D48291
Files:
lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp
test/Analysis/cxx-uninitialized-object.cpp
Index:
george.karpenkov added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:685
+
+ if (CXXParent && CXXParent->isLambda()) {
+CXXRecordDecl::capture_const_iterator CapturedVar =
Szelethus wrote:
> george.karpenkov wrote:
Szelethus added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:685
+
+ if (CXXParent && CXXParent->isLambda()) {
+CXXRecordDecl::capture_const_iterator CapturedVar =
george.karpenkov wrote:
> CXXParent is guaranteed
Szelethus added a comment.
Thanks for the review!
I spend some time thinking about the support for lambda functions, and I start
to think that checking for lambda misuse shouldn't be the responsibility of
this checker. I created a new revision for that discussion, I wouldn't like to
abandon
george.karpenkov requested changes to this revision.
george.karpenkov added a comment.
This revision now requires changes to proceed.
Looks good overall, but some nits inline.
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:682
+StringRef
Szelethus created this revision.
Szelethus added reviewers: xazax.hun, george.karpenkov, NoQ, rnkovacs.
Herald added subscribers: cfe-commits, mikhail.ramalho, a.sidorin, szepet,
whisperity.
Repository:
rC Clang
https://reviews.llvm.org/D48291
Files:
14 matches
Mail list logo