NoQ added inline comments.
================
Comment at: lib/StaticAnalyzer/Checkers/UninitializedObjectChecker.cpp:699
+    for (const LambdaCapture &L : CXXParent->captures()) {
+      if (L.getLocation() == Field->getLocation())
+        return L.getCapturedVar()->getName();
----------------
Uhm, this source location comparison looks really flaky. Ideally we would have 
looked up by field and get the captured variable directly, but it seems that we 
don't have a ready-made method for this.

The second ideal thing would probably be a reverse variant of 
`CXXRecordDecl::getCaptureFields()`. Looking at how it's implemented, it seems 
that capture indix is in sync with field index. Because we have 
`FieldDecl::getFieldIndex()`, probably we could just lookup the captures array 
by that index?


https://reviews.llvm.org/D48291



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to