[PATCH] D120065: [clang][SemaTemplate] Fix a stack use after scope

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 17 08:30:10 PST 2022


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/include/clang/AST/DeclTemplate.h:2464
   FriendTemplateDecl(DeclContext *DC, SourceLocation Loc,
-                     MutableArrayRef<TemplateParameterList *> Params,
+                     TemplateParameterList **Params, unsigned NumParams,
                      FriendUnion Friend, SourceLocation FriendLoc)
----------------
Is this change just to emphasize that this constructor won't copy the contents?


================
Comment at: clang/lib/AST/DeclTemplate.cpp:1103
+  TemplateParameterList **TPL = nullptr;
+  unsigned NumParams = 0;
+  if (!Params.empty()) {
----------------
just initialize to params.size already? or inline this variable


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120065



More information about the cfe-commits mailing list