[PATCH] D64448: gsl::Owner/gsl::Pointer: Add implicit annotations for some std types

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 07:37:37 PDT 2019


gribozavr added inline comments.


================
Comment at: clang/include/clang/Sema/Sema.h:6097
+
+  /// Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
+  void addDefaultGslPointerAttribute(TypedefNameDecl *TD);
----------------
It seems like this function does not add gsl::Owner.


================
Comment at: clang/lib/Sema/SemaTemplate.cpp:1689
   AddPushedVisibilityAttribute(NewClass);
+  addDefaultGslOwnerPointerAttribute(NewClass);
 
----------------
It shouldn't be necessary to perform inference here, instead, the attributes should be instantiated, see `instantiateDependentAlignedAttr` in SemaTemplateInstantiateDecl.cpp for an example.


================
Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:702
   SemaRef.InstantiateAttrs(TemplateArgs, D, Typedef);
+  SemaRef.addDefaultGslPointerAttribute(Typedef);
 
----------------
Ditto, should not be necessary to perform inference here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64448





More information about the cfe-commits mailing list