[PATCH] D43745: Fix cppcoreguidelines-pro-bounds-pointer-arithmetic not working for functions with auto return specifier.

2018-07-27 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Does it also work with lambdas (being implicitly auto) that return pointers? A test case for that would be nice. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D43745 ___ cfe-commits mailing list cfe-commits@

[PATCH] D16403: Add scope information to CFG

2017-06-23 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Please consider also https://reviews.llvm.org/D15031 It already handles all possible control flows. Instead of ScopeBegin and ScopeEnd, it introduces LifetimeEnds elements. It's a more specific in that is also correctly models the order of lifetime expiry of variables and

[PATCH] D18914: [clang-tidy] new readability-redundant-inline

2019-05-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Thank you for the review input! After learning about `inlinehint`, I don't feel its worthwhile for me to continue this check. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D18914/new/ https://reviews.llvm.org/D18914

[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

2019-05-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 198714. mgehre added a comment. Herald added a project: clang. Implement review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D24892/new/ https://reviews.llvm.org/D24892 Files: clang-tools-extra/clang

[PATCH] D61700: [clang-tidy] readability-redundant-declaration: fix false positive with C "extern inline"

2019-05-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: alexfh, danielmarjamaki. Herald added a subscriber: xazax.hun. Herald added a project: clang. readability-redundant-declaration was diagnosing a redundant declaration on "extern inline void f();", which is needed in C code to force an external

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-05-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: alexfh, aaron.ballman. Herald added subscribers: xazax.hun, mgorny. Herald added a project: clang. Finds non-static member functions that can be made ``const`` or ``static``. The check conservatively tries to preserve logical costness in favor

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-06-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[PATCH] D63088: [clang-tidy] misc-unused-parameters: don't comment out parameter name for C code

2019-06-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: klimek, ilya-biryukov, lebedev.ri, aaron.ballman. Herald added a subscriber: xazax.hun. Herald added a project: clang. The fixit `int square(int /*num*/)` yields `error: parameter name omitted` for C code. Enable it only for C++ code. Reposi

[PATCH] D63088: [clang-tidy] misc-unused-parameters: don't comment out parameter name for C code

2019-06-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 203873. mgehre added a comment. Fix rewrapped comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63088/new/ https://reviews.llvm.org/D63088 Files: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cp

[PATCH] D63088: [clang-tidy] misc-unused-parameters: don't comment out parameter name for C code

2019-06-16 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked an inline comment as done. mgehre added inline comments. Comment at: clang-tools-extra/test/clang-tidy/misc-unused-parameters.c:1-7 // RUN: %check_clang_tidy %s misc-unused-parameters %t -- -- -xc // Basic removal // = void a(int i) {;} // CHECK-M

[PATCH] D63088: [clang-tidy] misc-unused-parameters: don't comment out parameter name for C code

2019-06-16 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked an inline comment as done. mgehre added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/UnusedParametersCheck.cpp:141-156 + // Cannot remove parameter for non-local functions. if (Function->isExternallyVisible() || !Result.SourceManager->is

[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 sho

[PATCH] D61749: [clang-tidy] initial version of readability-convert-member-functions-to-static

2019-07-11 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 209360. mgehre added a comment. Implement comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 Files: clang-tools-extra/clang-tidy/readability/CMakeLists.txt cla

[PATCH] D61749: [clang-tidy] initial version of readability-convert-member-functions-to-static

2019-07-11 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. This should address all remaining comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 ___ cfe-commits mailing list cfe-commits@lis

[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: clang/include/clan

[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 how

[PATCH] D63954: Add lifetime categories attributes

2019-07-14 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments. Comment at: clang/include/clang/Basic/Attr.td:2770 +def Owner : InheritableAttr { + let Spellings = [CXX11<"gsl", "Owner">]; + let Subjects = SubjectList<[CXXRecord]>; aaron.ballman wrote: > xazax.hun wrote: > > aaron.ballman wrote

[PATCH] D63954: Add lifetime categories attributes

2019-07-14 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 209750. mgehre marked 23 inline comments as done. mgehre added a comment. - Don't crash when pretty-printing an Attribute with optional type argument - Don't crash AST dump when Owner/Pointer has no Type argument - gsl::Owner/gsl::Pointer: Make DerefType parame

[PATCH] D61749: [clang-tidy] initial version of readability-convert-member-functions-to-static

2019-07-16 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Thank you for the review, Aaron! Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D61749: [clang-tidy] initial version of readability-convert-member-functions-to-static

2019-07-16 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL366265: [clang-tidy] initial version of readability-convert-member-functions-to-static (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed

[PATCH] D63954: Add lifetime categories attributes

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. I think that I have addressed all open comments. Comment at: clang/include/clang/Basic/AttrDocs.td:4164 + let Content = [{ +When annotating a class ``O`` with ``[[gsl::Owner(T)]]``, then each function +that returns cv-qualified ``T&`` or ``T*`` is assum

[PATCH] D63954: Add lifetime categories attributes

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 211008. mgehre marked 6 inline comments as done. mgehre added a comment. - Disallow reference and array types as DerefType - Add example to documentation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/

[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 ow

[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 A

[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 clang/lib/Sema/SemaAttr.c

[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] D15032: [clang-tidy] new checker cppcoreguidelines-pro-lifetime

2019-07-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre abandoned this revision. mgehre added a comment. Herald added subscribers: wuzish, dmgreen. Upstreaming of this checker will happen with D63954 and following revisions. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D15032/new/ https://reviews.llv

[PATCH] D63954: Add lifetime categories attributes

2019-07-23 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:4167 + +The attribute ``[[gsl::Owner(T)]]`` applies to structs and classes that own an +object of type ``T``: aaron.ballman wrote: > Do either

[PATCH] D63954: Add lifetime categories attributes

2019-07-23 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 211370. mgehre marked 4 inline comments as done. mgehre added a comment. - Diagnose unions; improve other diagnostics; fix all comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.ll

[PATCH] D63954: Add lifetime categories attributes

2019-07-24 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 211600. mgehre marked an inline comment as done. mgehre added a comment. - Fix all comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 Files: clang/include/clang/

[PATCH] D63954: Add lifetime categories attributes

2019-07-24 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 9 inline comments as done. mgehre added inline comments. Comment at: clang/test/SemaCXX/attr-gsl-owner-pointer-parsing.cpp:2 +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int [[gsl::Owner]] i; aaron.ballman wrote: > This file tests part of parsing

[PATCH] D63954: Add lifetime categories attributes

2019-07-25 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL367040: Add lifetime categories attributes (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D

[PATCH] D63954: Add lifetime categories attributes

2019-07-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Thank you very much for dedicating your time for the review. It improved the code a lot! Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 ___ cfe-commit

[PATCH] D65127: Even more warnings utilizing gsl::Owner/gsl::Pointer annotations

2019-07-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:6581 +if (!Callee->getIdentifier()) { + auto OO = Callee->getOverloadedOperator(); + return OO == OverloadedOperatorKind::OO_Subscript || xazax.hun wrote: > If we want to relax th

[PATCH] D63954: Add lifetime categories attributes

2019-07-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. I will include your latest comments into D64448 Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 ___ cfe-commits maili

[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/ https://reviews.llv

[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 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 clang/include/clang/

[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 clang/include/clang/Sema/Sem

[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 co

[PATCH] D66164: [LifetimeAnalysis] Support std::stack::top() and std::optional::value()

2019-08-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added a reviewer: gribozavr. Herald added a project: clang. Diagnose dangling pointers that come from std::stack::top() and std::optional::value(). Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D66164 Files: clang/lib/Sema/SemaInit.cpp

[PATCH] D66164: [LifetimeAnalysis] Support std::stack::top() and std::optional::value()

2019-08-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked an inline comment as done. mgehre added inline comments. Comment at: clang/test/Sema/warn-lifetime-analysis-nocfg.cpp:172 T &operator*(); + T &value(); +}; xazax.hun wrote: > I actually was a bit lazy when I added these tests. Both `value` and

[PATCH] D66179: [LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

2019-08-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added a reviewer: gribozavr. Herald added a subscriber: Szelethus. Herald added a project: clang. This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the g

[PATCH] D66164: [LifetimeAnalysis] Support std::stack::top() and std::optional::value()

2019-08-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 214950. mgehre marked 2 inline comments as done. mgehre added a comment. Fix commit Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66164/new/ https://reviews.llvm.org/D66164 Files: clang/lib/Sema/SemaInit.cpp

[PATCH] D66164: [LifetimeAnalysis] Support std::stack::top() and std::optional::value()

2019-08-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 3 inline comments as done. mgehre added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:6583 .Cases("end", "rend", "cend", "crend", true) -.Cases("c_str", "data", "get", true) +.Cases("c_str", "data", "get", "value", true)

[PATCH] D66164: [LifetimeAnalysis] Support std::stack::top() and std::optional::value()

2019-08-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 214954. mgehre marked an inline comment as done. mgehre added a comment. Add tests for rvalue-ref overloads Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66164/new/ https://reviews.llvm.org/D66164 Files: clan

[PATCH] D66164: [LifetimeAnalysis] Support std::stack::top() and std::optional::value()

2019-08-14 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL368929: [LifetimeAnalysis] Support std::stack::top() and std::optional::value() (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to

[PATCH] D66179: [LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

2019-08-14 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 6 inline comments as done. mgehre added inline comments. Comment at: clang/lib/Sema/SemaAttr.cpp:102 + dyn_cast_or_null(Record->getDescribedTemplate())) { +if (auto *Def = Record->getDefinition()) + addGslOwnerPointerAttributeIfNotExisting(Context

[PATCH] D66303: [LifetimeAnalysis] Add support for free functions

2019-08-15 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments. Comment at: clang/lib/Sema/SemaInit.cpp:6622 +return false; + const auto *RD = FD->getParamDecl(0)->getType()->getPointeeCXXRecordDecl(); + if (!FD->isInStdNamespace() || !RD || !RD->isInStdNamespace()) Maybe move the `Callee->

[PATCH] D66365: [clang-tidy] [readability-convert-member-functions-to-static] ignore functions that hide base class methods

2019-08-16 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: aaron.ballman, Eugene.Zelenko. Herald added a subscriber: xazax.hun. Herald added a project: clang. Fixes bug https://bugs.llvm.org/show_bug.cgi?id=43002 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D66365 Files: clang-t

[PATCH] D66179: [LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)

2019-08-16 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 4 inline comments as done. mgehre added a comment. I now start to wonder if we should instead put the attribute on all declarations (instead of just the canonical). Later redeclarations automatically inherit the attributes. This would make both the checking easier (just check any d

[PATCH] D66365: [clang-tidy] [readability-convert-member-functions-to-static] ignore functions that hide base class methods

2019-08-19 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. I struggle myself to fully understand the motivation behind the bug report. This is certainly not code that I would write. So I don't really care about that kind of code and I didn't want to be in the way of other people's way of writing C++. Alternatively, we could ask

[PATCH] D63088: [clang-tidy] misc-unused-parameters: don't comment out parameter name for C code

2019-06-21 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL364106: [clang-tidy] misc-unused-parameters: don't comment out parameter name for C code (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed

[PATCH] D63954: Add lifetime categories attributes

2019-06-28 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added a reviewer: gribozavr. Herald added a project: clang. This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined

[PATCH] D63954: Add lifetime categories attributes

2019-06-28 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 207138. mgehre added a comment. Fix typo Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.

[PATCH] D63954: Add lifetime categories attributes

2019-06-28 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. We can try to add the annotations to libcxx (which will still take time), but there are also other standard libraries (libstdc++, MSVC) that can be used with clang. Eventually everybody will have lifetime annotations (of course ;-) ), but in the meantime there seems to be n

[PATCH] D63954: Add lifetime categories attributes

2019-06-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. We can and should explore both options and see what works best. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 ___ cfe-commits mailing

[PATCH] D63954: Add lifetime categories attributes

2019-06-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 207235. mgehre added a comment. Address some review comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 Files: clang/include/clang/Basic/Attr.td clang/include/

[PATCH] D63954: Add lifetime categories attributes

2019-06-30 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4560-4561 + if(AL.getKind() == ParsedAttr::AT_Owner) { +if (checkAttrMutualExclusion(S, D, AL)) + return; +if (const auto *Attr = D->getAttr()) {

[PATCH] D63954: Add lifetime categories attributes

2019-07-01 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 207381. mgehre marked 5 inline comments as done. mgehre added a comment. - Address more review comments. - git-clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D6395

[PATCH] D63954: Add lifetime categories attributes

2019-07-01 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. I understand that putting types on forward declared header (standard libraries / third party libraries) is not a approach we should favor. Thank you for your good arguments. API notes seems like a really good approach for this (I would like to help with the upstreaming),

[PATCH] D63954: Add lifetime categories attributes

2019-07-01 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 207400. mgehre added a comment. - Add newline at end of file Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 Files: clang/include/clang/Basic/Attr.td clang/include/c

[PATCH] D63954: Add lifetime categories attributes

2019-07-02 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 207613. mgehre added a comment. - Make the list of attribute properties more consistent. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D63954/new/ https://reviews.llvm.org/D63954 Files: clang/include/clang/Bas

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-07-02 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Friendly ping. Are there outstanding concerns that I could address? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 ___ cfe-commits mail

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-07-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 208505. mgehre marked 11 inline comments as done. mgehre added a comment. - Address review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 Files: clang-tools-

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-07-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp:96 +CheckFactories.registerCheck( +"readability-static-method"); CheckFactories.registerCheck(

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-07-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 208785. mgehre added a comment. Move checks into AST matchers Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 Files: clang-tools-extra/clang-tidy/readability/CMakeList

[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 functions

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-05-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. I have thought about splitting the check into separate `static` & `const`, but kept it together because the analysis for both cases is very similar, i.e. finding the usage of `this`. Also, both checks share many preconditions, e.g. not applying them to virtual methods or

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-05-12 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre added inline comments. Comment at: clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:209 +void KeepLambdas() { + auto F = +[]() { return 0; }; + auto F2 = []() { return 0; }; JonasToth wrote:

[PATCH] D61700: [clang-tidy] readability-redundant-declaration: fix false positive with C "extern inline"

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. mgehre marked 2 inline comments as done. Closed by commit rL360613: [clang-tidy] readability-redundant-declaration: fix false positive with C… (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a

[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Do I wait for @alexfh to turn his red into a green, too? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D24892/new/ https://reviews.llvm.org/D24892 ___ cfe-commits mailing list cf

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 17 inline comments as done. mgehre added inline comments. Comment at: clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:312 +return const_cast(this)->get(); + } + JonasToth wrote: > mgehre wrote: > > JonasToth wrote: > > >

[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 199329. mgehre marked an inline comment as done. mgehre added a comment. Remove ``const`` part from this PR. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D6

[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 199330. mgehre added a comment. Fix wrong merge of ReleaseNotes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D24892/new/ https://reviews.llvm.org/D24892 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/P

[PATCH] D61874: [clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance (bug 40544)

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: aaron.ballman, alexfh, xazax.hun. mgehre added projects: clang, clang-tools-extra. Herald added a subscriber: rnkovacs. Fixed https://bugs.llvm.org/show_bug.cgi?id=40544 Before, we would generate a fixit like `(anonymous namespace)::Foo::fun();

[PATCH] D61874: [clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance (bug 40544)

2019-05-14 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL360698: [clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance… (authored by mgehre, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Change

[PATCH] D24892: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type-member-init

2019-05-23 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL361601: [clang-tidy] Add option "LiteralInitializers" to cppcoreguidelines-pro-type… (authored by mgehre, committed by ).

[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-09-26 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: aaron.ballman, gribozavr, hokein, alexfh. mgehre added a project: clang. Herald added subscribers: xazax.hun, mgorny. Finds non-static member functions that can be made ``const`` because the functions don't use ``this`` in a non-const way. The

[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-09-29 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 222331. mgehre marked 6 inline comments as done. mgehre added a comment. - Implement review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68074/new/ https://reviews.llvm.org/D68074 Files: clang-tools

[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-09-29 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. In D68074#1683770 , @lebedev.ri wrote: > Awesome! > I believe i have asked this question in the convert-to-static diff - can > ExprMutAnalyzer be used here? I believe in this case, we can get away with a simpler analysis. Becaus

[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-10-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked an inline comment as done. mgehre added inline comments. Comment at: clang-tools-extra/test/clang-tidy/readability-make-member-function-const.cpp:311 + // This member function must stay non-const, even though + // it only calls other private const member function

[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-10-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/readability-make-member-function-const.rst:10 +The check conservatively tries to preserve logical costness in favor of +physical costness. The only operati

[PATCH] D69145: Give readability-redundant-member-init an option IgnoreBaseInCopyConstructors to avoid breaking code with gcc -Werror=extra

2019-10-19 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp:55 const auto *Construct = Result.Nodes.getNodeAs("construct"); + const auto* ConstructorDecl = Result.Nodes.getNodeAs( "constructor" ); + Extra

[PATCH] D69145: Give readability-redundant-member-init an option IgnoreBaseInCopyConstructors to avoid breaking code with gcc -Werror=extra

2019-10-19 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Exactly due to the issue you are fixing here, we ended up disabling the complete check because we didn't want to live with the warnings it produced on -Wextra. Therefore, I'm actually strongly in favor to enable the option by default. When others see that clang-tidy fixi

[PATCH] D68074: [clang-tidy] Add readability-make-member-function-const

2019-10-20 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 225804. mgehre marked 6 inline comments as done. mgehre added a comment. - Update documentation Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D68074/new/ https://reviews.llvm.org/D68074 Files: clang-tools-extr

[PATCH] D80301: [yaml][clang-tidy] Fix new line YAML serialization

2020-05-21 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Thanks for doing this! I didn't work on the YAML parser before, so I cannot give formal approval. Comment at: llvm/lib/Support/YAMLTraits.cpp:904 + std::string &Val) { + Val.clear(); + size_t CurrentPos = 0; -

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-05-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 266083. mgehre marked an inline comment as done. mgehre added a comment. Fix comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77572/new/ https://reviews.llvm.org/D77572 Files: clang-tools-extra/clang-ti

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-05-25 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 5 inline comments as done. mgehre added a comment. Aaron, thank you very much for taking the time to review this PR. Comment at: clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp:61 + hasBody(allOf(hasDescendant(returns(true)), +

[PATCH] D80301: [yaml][clang-tidy] Fix new line YAML serialization

2020-06-02 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added inline comments. Comment at: llvm/lib/Support/YAMLTraits.cpp:904 + std::string &Val) { + Val.clear(); + size_t CurrentPos = 0; DmitryPolukhin wrote: > mgehre wrote: > > I wonder whether using StringRef::spl

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-06-03 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 268120. mgehre added a comment. Implemented njames93's comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77572/new/ https://reviews.llvm.org/D77572 Files: clang-tools-extra/clang-tidy/readability/CMakeLi

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-06-03 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGadd51e152aa6: [clang-tidy] add new check readability-use-anyofallof (authored by mgehre). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77572/new/ https://r

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-04-06 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: aaron.ballman, alexfh, hokein. Herald added subscribers: xazax.hun, mgorny. Herald added a project: clang. Finds range-based for loops that can be replaced by a call to ``std::any_of`` or ``std::all_of``. In C++ 20 mode, suggests ``std::ranges:

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-04-07 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 6 inline comments as done. mgehre added a comment. In D77572#1965143 , @njames93 wrote: > I'm struggling to see the value of this check though. If it was reworked to > check for loop in the middle of a function it would have a lot more value

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-04-07 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 255812. mgehre added a comment. Review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77572/new/ https://reviews.llvm.org/D77572 Files: clang-tools-extra/clang-tidy/readability/UseAnyOfAllOfCheck.cpp

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-04-07 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 255814. mgehre added a comment. Review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D77572/new/ https://reviews.llvm.org/D77572 Files: clang-tools-extra/clang-tidy/readability/CMakeLists.txt clang-

[PATCH] D77680: [clang-tidy] misc-unused-parameters: Don't remove parameter from lambda

2020-04-07 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: aaron.ballman, alexfh, hokein, njames93. Herald added a subscriber: xazax.hun. Herald added a project: clang. mgehre added a project: clang-tools-extra. mgehre edited the summary of this revision. Previously, the check would fix using fn = v

[PATCH] D77680: [clang-tidy] misc-unused-parameters: Don't remove parameter from lambda

2020-04-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. In D77680#1968860 , @njames93 wrote: > Outright disabling for lambdas probably isn't the ideal solution, however > it's at least a good stepping stone til a better solution can be found. I fully agree! Repository: rG LLVM Git

[PATCH] D77680: [clang-tidy] misc-unused-parameters: Don't remove parameter from lambda

2020-04-09 Thread Matthias Gehre via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGeaa55590945a: [clang-tidy] misc-unused-parameters: Don't remove parameter from lambda (authored by mgehre). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D776

[PATCH] D77572: [clang-tidy] add new check readability-use-anyofallof

2020-04-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Thanks @njames93, this is a good examples which I did not consider yet. I agree that only transforming the second loop would make the code worse. I would argue that a human seeing a warning on the second loop might also realize that the first loop can be transformed in a

  1   2   >