[PATCH] D153273: [analyzer] Rework support for CFGScopeBegin, CFGScopeEnd, CFGLifetime elements

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 7 09:46:59 PDT 2023


ymandel accepted this revision.
ymandel added inline comments.


================
Comment at: clang/lib/Analysis/CFG.cpp:773
   void addLoopExit(const Stmt *LoopStmt);
-  void addAutomaticObjDtors(LocalScope::const_iterator B,
-                            LocalScope::const_iterator E, Stmt *S);
-  void addLifetimeEnds(LocalScope::const_iterator B,
-                       LocalScope::const_iterator E, Stmt *S);
   void addAutomaticObjHandling(LocalScope::const_iterator B,
                                LocalScope::const_iterator E, Stmt *S);
----------------
Consider adding comments describing these methods, either here or at the function definitions.


================
Comment at: clang/lib/Analysis/CFG.cpp:1815
+
+  for (std::size_t idx = 1; idx < LocalScopeEndMarkers.size(); ++idx) {
+    LocalScope::const_iterator B = LocalScopeEndMarkers[idx];
----------------
if `LocalScopeEndMarkers` isn't supposed to change inside the body of the loop, then consider making this call once
`for (std::size_t idx = 1, N = LocalScopeEndMarkers.size(); idx < N; ...`


================
Comment at: clang/lib/Analysis/CFG.cpp:1847-1849
+      if (Ty->isReferenceType()) {
+        Ty = getReferenceInitTemporaryType(VD->getInit());
+      }
----------------



================
Comment at: clang/lib/Analysis/CFG.cpp:1911-1918
+  if (!BuildOpts.AddImplicitDtors && !BuildOpts.AddLifetime &&
+      !BuildOpts.AddScopes) {
     return;
+  }
 
-  autoCreateBlock();
+  if (SrcPos == DstPos) {
+    return;
----------------
Remove extra braces?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153273



More information about the cfe-commits mailing list