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

Kinuko Yasuda via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 17:08:42 PDT 2023


================
@@ -288,6 +288,18 @@ static void insertIfFunction(const Decl &D,
     Funcs.insert(FD);
 }
 
+static Expr *getRetValueFromSingleReturnStmtMethod(const CXXMemberCallExpr &C) {
+  auto *D = cast_or_null<CXXMethodDecl>(C.getMethodDecl()->getDefinition());
+  if (!D)
+    return nullptr;
+  auto *S = cast<CompoundStmt>(D->getBody());
+  if (S->size() != 1)
+    return nullptr;
+  if (auto *RS = dyn_cast<ReturnStmt>(*S->body_begin()))
+    return RS->getRetValue()->IgnoreParenImpCasts();
+  return nullptr;
----------------
kinu wrote:

Applied with slight modifications

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


More information about the cfe-commits mailing list