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

2019-08-07 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL368147: gsl::Owner/gsl::Pointer: Add implicit annotations for some std types (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to

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

2019-08-06 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision. gribozavr added inline comments. This revision is now accepted and ready to land. Comment at: clang/include/clang/Sema/Sema.h:6122 + /// std::container::iterator. \param UnderlyingRecord The record named by ND. + void

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

2019-07-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 212446. mgehre added a comment. - Fix crash Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64448/new/ https://reviews.llvm.org/D64448 Files: clang/include/clang/Basic/AttrDocs.td

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

2019-07-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 212441. mgehre added a comment. - Add missing check Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64448/new/ https://reviews.llvm.org/D64448 Files: clang/include/clang/Basic/AttrDocs.td

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

2019-07-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre 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); gribozavr wrote: > It seems like this function

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

2019-07-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 212439. mgehre marked 6 inline comments as done. mgehre added a comment. - Fix comments - Add Pointer via typedef on ClassTemplateDecl Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64448/new/

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

2019-07-29 Thread Dmitri Gribenko via Phabricator via cfe-commits
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

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

2019-07-21 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In D64448#1595022 , @mgehre wrote: > In D64448#1595017 , @lebedev.ri > wrote: > > > Just passing-by thought: > > These attributes that are being added implicitly, it will be possible

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

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. In D64448#1595017 , @lebedev.ri wrote: > Just passing-by thought: > These attributes that are being added implicitly, it will be possible to > differentiate > whether an attribute was actually present in the code, or was added

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

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 211010. mgehre added a comment. - Remove type traits Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64448/new/ https://reviews.llvm.org/D64448 Files: clang/include/clang/Sema/Sema.h

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

2019-07-21 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. Just passing-by thought: These attributes that are being added implicitly, it will be possible to differentiate whether an attribute was actually present in the code, or was added implicitly, say for clang-tidy check purposes? Is there some 'implicit' bit on these, or

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

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. This should fix all open comments. Comment at: clang/include/clang/Basic/AttrDocs.td:4167-4168 pointer/reference to the data owned by ``O``. The owned data is assumed to end -its lifetime once the owning object's lifetime ends. +its lifetime once the

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

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 211009. mgehre marked 12 inline comments as done. mgehre added a comment. - Merge branch 'lifetime-categories' into hardcode-lifetime-categories; Split test; Move test to AST dump; fix for comments; Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

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

2019-07-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added subscribers: aaron.ballman, rsmith. rsmith added inline comments. Comment at: clang/include/clang/Basic/Attr.td:2773 + let Args = [TypeArgument<"DerefType", /*opt=*/1>]; + let MeaningfulToClassTemplateDefinition = 1; let Documentation = [LifetimeOwnerDocs];

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

2019-07-12 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment. In D64448#1581866 , @mgehre wrote: > I didn't know whether they would differ, but the test tells me that they > don't differ significantly (i.e. in introducing new techniques). Okay -- I would prefer if you intentionally

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

2019-07-11 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. In D64448#1581771 , @gribozavr wrote: > In D64448#1581719 , @mgehre wrote: > > > In D64448#159 , @gribozavr > > wrote: > > > > > I don't know

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

2019-07-11 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 209370. mgehre marked 9 inline comments as done. mgehre added a comment. - Implement comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64448/new/ https://reviews.llvm.org/D64448 Files:

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

2019-07-11 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added inline comments. Comment at: clang/include/clang/Basic/TokenKinds.def:486 +TYPE_TRAIT_1(__is_gsl_owner, IsGslOwner, KEYCXX) +TYPE_TRAIT_1(__is_gsl_pointer, IsGslPointer, KEYCXX) KEYWORD(__underlying_type , KEYCXX) mgehre wrote: >

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

2019-07-11 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment. In D64448#1581719 , @mgehre wrote: > In D64448#159 , @gribozavr wrote: > > > I don't know how various versions of libstdc++ differ. > > > The current implementation passed the

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

2019-07-11 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 5 inline comments as done. mgehre added a comment. In D64448#159 , @gribozavr wrote: > For example, libc++ wraps everything in std in an inline namespace. I believed that I had written a test for inline namespaces, but seems that I

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

2019-07-10 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment. Just as Sidenote in case you were not aware: There is a check in clang-tidy for `gsl::owner` (https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines-owning-memory.html) It will benefit from your annotation and can be simplified. Repository: rG LLVM

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

2019-07-10 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment. > Those are already there in clang/test/SemaCXX/attr-gsl-owner-pointer.cpp. I see. Sorry, but that seems insufficient to me -- different libraries use different patterns. For example, libc++ wraps everything in std in an inline namespace. I don't know how various

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

2019-07-09 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. In D64448#1577109 , @gribozavr wrote: > > The tests are currently here > > I think due to their dependency on a standard library, they are not a good > > fit for clang/test/. Where else could I put them? > > Make some mocks

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

2019-07-09 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added a comment. > The tests are currently here > I think due to their dependency on a standard library, they are not a good > fit for clang/test/. Where else could I put them? Make some mocks that reproduce the salient parts of different libraries, the coding patterns they use, and

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

2019-07-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: gribozavr, xazax.hun. Herald added a subscriber: rnkovacs. Herald added a project: clang. Make the DerefType, i.e. the argument of gsl::Owner/gsl::Pointer optional for now. The DerefType is used when infering lifetime annotations of