[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In D64256#1626329 , @xazax.hun wrote: > In D64256#1626279 , @leonardchan > wrote: > > > In D64256#1626025 , @xazax.hun > > wrote: > > > > > In

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-12 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. In D64256#1626279 , @leonardchan wrote: > In D64256#1626025 , @xazax.hun wrote: > > > In D64256#1625998 , @leonardchan > > wrote: > > > > > Hi. I

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. In D64256#1626025 , @xazax.hun wrote: > In D64256#1625998 , @leonardchan > wrote: > > > Hi. I noticed in our builders that both of the warnings introduced in this > > patch are being

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-12 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. In D64256#1625998 , @leonardchan wrote: > Hi. I noticed in our builders that both of the warnings introduced in this > patch are being diagnosed for pointers that don't use GSL at all. I'm > attempting to make a small

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-12 Thread Leonard Chan via Phabricator via cfe-commits
leonardchan added a comment. Hi. I noticed in our builders that both of the warnings introduced in this patch are being diagnosed for pointers that don't use GSL at all. I'm attempting to make a small reproducer now. Repository: rL LLVM CHANGES SINCE LAST ACTION

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-07 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun marked an inline comment as done. xazax.hun added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7077 +// someContainer.add(std::move(localOWner)); +// return p; +if (!IsTempGslOwner && pathOnlyInitializesGslPointer(Path) &&

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-06 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7077 +// someContainer.add(std::move(localOWner)); +// return p; +if (!IsTempGslOwner && pathOnlyInitializesGslPointer(Path) && xazax.hun wrote: > gribozavr wrote: > > Why

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-06 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL368072: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes (authored by xazax, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-06 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun marked an inline comment as done. xazax.hun added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7077 +// someContainer.add(std::move(localOWner)); +// return p; +if (!IsTempGslOwner && pathOnlyInitializesGslPointer(Path) &&

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-08-06 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision. gribozavr added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7031 + LLVM_FALLTHROUGH; +case IndirectLocalPathEntry::DefaultInit: return Path[I].E->getSourceRange(); This change would be best committed

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-29 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. Thanks for the review! Since I did some refactoring I will wait for an additional accept before committing. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 ___

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-29 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7095 auto *MTE = dyn_cast(L); + if (IsGslPtrInitWithGslTempOwner) { +Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange; gribozavr wrote: > It is unclear

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-29 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 212205. xazax.hun marked an inline comment as done. xazax.hun added a comment. - Actually move the code snippet in question. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files:

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-29 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 212204. xazax.hun marked an inline comment as done. xazax.hun added a comment. - A small refactoring based on an observation from a review comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files:

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-29 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision. gribozavr added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7095 auto *MTE = dyn_cast(L); + if (IsGslPtrInitWithGslTempOwner) { +Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange;

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-24 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 211580. xazax.hun added a comment. - Fix a false positive case found by running over ~200 open source projects CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files:

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-22 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 211150. xazax.hun added a comment. - Fix a false positive from previous change. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-22 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 211142. xazax.hun added a comment. - Fix a TODO and add some more tests. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-22 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 211127. xazax.hun marked 5 inline comments as done. xazax.hun added a comment. - Address the rest of the review comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files:

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-11 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added inline comments. Comment at: clang/test/Sema/warn-lifetime-analysis-nocfg.cpp:25 + +struct [[gsl::Owner(int)]] OwnerWithConv { + OwnerWithConv(); xazax.hun wrote: > gribozavr wrote: > > Would be nice if the second pair of types had clearly

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun marked an inline comment as done. xazax.hun added a comment. Thanks for the review! I will update the patch soon. As there is a dependency that is not accepted yet Richard (who authored the code I extended) might have some chance to take a look at this patch.

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-10 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision. gribozavr added a comment. This revision is now accepted and ready to land. I'm not an expert in SemaInit code, but this change LGTM. Comment at: clang/test/Sema/warn-lifetime-analysis-nocfg.cpp:8 + +struct OwnerWithConv; +

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-09 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 208709. xazax.hun added a comment. - Address review comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaInit.cpp

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-09 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun marked 6 inline comments as done. xazax.hun added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:7076 +auto Prefix = llvm::makeArrayRef(Path).drop_back(); + if (pathInitializeLifetimePointer(Prefix)) +IsLifetimePtrInitWithTempOwner =

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-09 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:6549 +static bool +pathInitializeLifetimePointer(llvm::ArrayRef Path) { + return Path.size() > 0 && llvm::all_of(Path, [=](IndirectLocalPathEntry E) { Move closer to the point of usage?

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 208441. xazax.hun added a comment. - Fix a typo. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaInit.cpp

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun updated this revision to Diff 208439. xazax.hun marked 12 inline comments as done. xazax.hun added a comment. - Address review comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64256/new/ https://reviews.llvm.org/D64256 Files:

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments. Comment at: clang/test/Sema/warn-lifetime-analysis-nocfg.cpp:22 + int *release2(); + int *c_str() const; +}; gribozavr wrote: > This method is confusing -- is it a name that the warning is supposed to know > about? Not yet,

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun marked 5 inline comments as done. xazax.hun added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:6510 LifetimeBoundCall, +LifetimePointerInit, +LifetimeTempOwner gribozavr wrote: > What is this name supposed to mean?

[PATCH] D64256: Teach some warnings to respect gsl::Pointer and gsl::Owner attributes

2019-07-08 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:6510 LifetimeBoundCall, +LifetimePointerInit, +LifetimeTempOwner What is this name supposed to mean? Initialization of a "lifetime pointer"? What's a "lifetime pointer"? If