[clang] [clang][dataflow] Model the fields that are accessed via inline accessors (PR #66368)

via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 06:13:22 PDT 2023


================
@@ -1446,6 +1446,51 @@ TEST(TransferTest, BaseClassInitializer) {
       llvm::Succeeded());
 }
 
+TEST(TransferTest, StructModeledFieldsWithAccessor) {
+  std::string Code = R"(
+    class S {
+      int *P;
+      int *Q;
+      int X;
+      int Y;
+      int Z;
+    public:
+      int *getPtr() const { return P; }
+      int *getPtrNonConst() { return Q; }
+      int getInt(int i) const { return X; }
----------------
martinboehme wrote:

Can you add a case that returns a reference? This produces a slightly different shape of AST (without an `LValueToRValue` cast).

https://github.com/llvm/llvm-project/pull/66368


More information about the cfe-commits mailing list