xazax.hun added inline comments.

================
Comment at: clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp:185
+      // base classes, because they are not visible in derived classes.
+      getFieldsFromClassHierarchy(Base.getType(), /*IgnorePrivateFields=*/true,
+                                  Fields);
----------------
Will this work well for all cases of diamond shape inheritance?

E.g.:
```
struct A { int a; };
struct B : virtual A { int b; };
struct C : virtual A { int c; };
struct D : B, C { int d; };
```

In the above code, I would expect the field `a` to appear only once. I guess 
this should work well because of the set representation although we will visit 
A twice.

On the other hand, consider:
```
struct A { int a; };
struct B : A { int b; };
struct C : A { int c; };
struct D : B, C { int d; };
```

Here, in fact, we have 2 instances of the field `a`. Both `B::a` and `C::a` are 
part of `D`. I suspect that the current implementation might not handle this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122273

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

Reply via email to