ChuanqiXu added inline comments.

================
Comment at: clang/lib/Sema/Scope.cpp:152-154
+  // Consider the variable as NRVO candidate if the return slot is available
+  // for it in the current scope, or if it can be available in outer scopes.
+  NRVO = CanBePutInReturnSlot ? VD : nullptr;
----------------
What if NRVO contains a value already? It is possible due to the value of NRVO 
could be set by its children.


================
Comment at: clang/lib/Sema/Scope.cpp:184-185
+  //    }
+  if (!getEntity())
+    getParent()->NRVO = *NRVO;
 }
----------------
There is a similar problem. It looks not right if the NRVO of the parent owns a 
value already.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119792

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

Reply via email to