[PATCH] D65120: More warnings regarding gsl::Pointer and gsl::Owner attributes

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 22 15:31:28 PDT 2019


xazax.hun created this revision.
xazax.hun added reviewers: gribozavr, rsmith, mgehre.
xazax.hun added a project: clang.
Herald added subscribers: cfe-commits, Charusso, gamesh411, Szelethus, dkrupp, rnkovacs.

This patch extends the warnings for additional cases:

1. When the temporary is the result of a function call.
2. When we call some well-known methods on a temporary object.

The latter is using a hard coded list of those well-known functions. Later revisions might replace string matching with checking function annotations from the lifetime papers. There are two reasons to hard code the list this way for now:

1. The spelling and semantics of function annotations might change in the near future after incorporating some implementation related experience so we are not rushing adding those annotations to clang just yet (as opposed to class annotations which are considered quite stable now.)
2. Checking for those well known functions is a huge usability boost for the check.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65120

Files:
  clang/lib/Sema/SemaInit.cpp
  clang/test/Analysis/inner-pointer.cpp
  clang/test/Sema/warn-lifetime-analysis-nocfg.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65120.211214.patch
Type: text/x-patch
Size: 6169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190722/69fdfa04/attachment.bin>


More information about the cfe-commits mailing list