[PATCH] D130600: [clang][dataflow] Handle return statements

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 26 14:37:00 PDT 2022


gribozavr2 added inline comments.


================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:110
 
+  /// Assigns `Loc` as the storage location of `return`.
+  ///
----------------



================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:120-121
+
+  /// Returns the storage location assigned to `return` or null if `return` has
+  /// no assigned storage location.
+  StorageLocation *getReturnStorageLocation() const { return ReturnLoc; }
----------------



================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:224-225
 
+  /// Returns the storage location assigned to `return` in the environment or
+  /// null if `return` has no assigned storage location in the environment.
+  StorageLocation *getReturnStorageLocation() const;
----------------



================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:347
+    assert(Val != nullptr);
+    Env.setValue(*Loc, *Val);
+  }
----------------
Please add a TODO about modeling NRVO.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130600



More information about the cfe-commits mailing list