mboehme marked 2 inline comments as done.
mboehme added inline comments.

================
Comment at: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp:303
 
-  auto *InitStmtLoc = Env.getStorageLocation(*InitStmt, SkipPast::Reference);
-  if (InitStmtLoc == nullptr)
-    return;
-
-  auto *InitStmtVal = Env.getValue(*InitStmtLoc);
-  if (InitStmtVal == nullptr)
-    return;
-
   if (Member->getType()->isReferenceType()) {
+    auto *InitStmtLoc = Env.getStorageLocationStrict(*InitStmt);
----------------
xazax.hun wrote:
> I am wondering whether it is more robust to branch directly on the value 
> category of `InitStmt`, although I cannot think of cases where this condition 
> would go wrong. Feel free to ignore. 
I think it's actually more robust to branch on `isReferenceType()`, because 
`getStorageLocationStrict` contains an assertion that `InitStmt` is a value 
category -- so we're verifying that both of these conditions are met. If 
instead we branched on `InitStmt->isGLValue()`, we wouldn't be looking at 
`Member->getType()->isReferenceType()` at all, and we wouldn't be verifying 
that it matches our expectations (i.e. that it's a reference).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150656/new/

https://reviews.llvm.org/D150656

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

Reply via email to