xazax.hun added inline comments.

================
Comment at: 
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp:501
+  auto FieldAccessM = 
memberExpr(hasDeclaration(equalsNode(FD))).bind("access");
+  // TODO: Should we only regard asserts as guards, or maybe something else 
too?
+  auto GuardM = 
callExpr(callee(functionDecl(hasName("assert")))).bind("guard");
----------------
I would consider any access that is guarded by if, ternary operator, switch as 
a guard.

For example I would consider field guarded in the following method:
```
int *method() {
  return cond ? field : nullptr;
}
```

But unguarded in this:
```
int *method() {
  return field ? field2 : nullptr;
}
```

Also, knowing that a variable is guarded or not might be a useful heuristic for 
other checks too. So if you do plan to cover all those cases. I would recommend 
to implement it outside of this check so other checks might also leverage this 
functionality.


https://reviews.llvm.org/D51866



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

Reply via email to