[clang] Reland: [clang] Diagnose dangling issues for the "Container<GSLPointer>" case. #107213 (PR #108344)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 16:23:50 PDT 2024


================
@@ -347,6 +361,30 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) {
   return false;
 }
 
+// Returns true if we should perform the GSL analysis on the first argument for
+// the given constructor.
+static bool
+shouldTrackFirstArgumentForConstructor(const CXXConstructExpr *Ctor) {
+  const auto *ClassD = Ctor->getConstructor()->getParent();
+
+  auto FirstArgType = Ctor->getArg(0)->getType();
----------------
usx95 wrote:

nit: move below closer to its first use near `return isGSLOwner(FirstArgType)`

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


More information about the cfe-commits mailing list