Page MenuHomePhabricator

bernhardmgruber (Bernhard Manfred Gruber)
User

Projects

User does not belong to any projects.

User Details

User Since
Dec 30 2018, 9:21 AM (49 w, 2 d)

Recent Activity

Wed, Dec 4

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

@Eugene.Zelenko I tried to find what you refer to by PR44206, but I could not find anything :/ Can you please provide me with a link? Thank you!

Wed, Dec 4, 8:27 AM · Restricted Project

May 9 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
  • fixed formatting
  • fixed function names in tests
  • added -fexceptions to test arguments
  • fixed type in release notes
May 9 2019, 4:14 PM · Restricted Project
bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

@aaron.ballman I do not have commit privileges and I would be very thankful, if you could commit this patch for me! Thank you!

May 9 2019, 5:46 AM · Restricted Project

May 8 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

@aaron.ballman and @JonasToth: Thank you for the patience and all the feedback! It means a great deal to me to have a patch accepted here!

May 8 2019, 4:46 PM · Restricted Project

May 7 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Fixed small nits suggested by @aaron.ballman. Thanks!

May 7 2019, 2:34 PM · Restricted Project

May 4 2019

bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
May 4 2019, 8:28 AM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

It took a long while to figure out how to handle certain macro cases. Here is what I came up with:

May 4 2019, 8:28 AM · Restricted Project

Mar 18 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

Thank you for the rich feedback @aaron.ballman. I found a solution which seems to work for many of my test cases.

Mar 18 2019, 7:03 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
  • extracting specifiers from the return type if it consists of a multitoken built-in type, and preprending it to 'auto'.
  • extended matcher to include friend declarations of functions
  • added many tests for return types which contain specifiers
Mar 18 2019, 6:59 PM · Restricted Project

Mar 9 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
  • added support for __restrict
  • added two dots at end of comments
Mar 9 2019, 1:51 PM · Restricted Project

Mar 4 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Fixed some little nits, thanks @JonasToth!

Mar 4 2019, 3:40 PM · Restricted Project

Feb 27 2019

bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
Feb 27 2019, 2:16 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
  • renamed the check to modernize-use-trailing-return-type
  • fixed the out-of-bounds access to check whether there is a space after the return type
Feb 27 2019, 2:16 PM · Restricted Project
bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

Hi guys!

Feb 27 2019, 7:01 AM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
  • rebased onto current master
  • implemented a basic check for name collisions of unqualified names in the return type with function arugment names using RecursiveASTVisitor
  • moved retrieval of FunctionTypeLoc out of findTrailingReturnTypeSourceLocation()
  • replaced F.getReturnType().hasLocalQualifiers() by custom function hasAnyNestedLocalQualifiers(), as the former does not work if the qualifiers are not on the topmost type. E.g.: const int*. This is a PointerType without qualifiers, the const qualifier is part of the nested pointee type.
  • inhibiting the rewrite, if the topmost return type is a decltype expression. the source range in this case does not include the expression in parenthesis after the decltype
  • inserting an additional space after auto in case there was no space between the return type and the function name. E.g.: int*f();
  • extended documentation with known limitations
  • added more tests
Feb 27 2019, 6:56 AM · Restricted Project

Jan 26 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

Thank you for the feedback!

Jan 26 2019, 5:41 PM · Restricted Project

Jan 22 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

Thank you again @JonasToth for all your valueable input! I could almost successfully run my check on the llvm/lib subfolder. I created a compilation database from within Visual Studio using an extension called SourceTrail. One of the issues was the following:

Jan 22 2019, 4:41 PM · Restricted Project

Jan 17 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

Thank you @JonasToth for providing more feedback! I will add a few more tests with templates. Maybe I should even try to run the check on Boost and see what happens.

Jan 17 2019, 1:33 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Addressed most of the new review comments (mainly uppercasing start of comments).

Jan 17 2019, 1:18 PM · Restricted Project

Jan 11 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Skipping the check for functions which do not have a valid location. This occurred when I run the check on the LLVM code base. It looked like the matcher matched something like a built in operator.

Jan 11 2019, 7:55 AM · Restricted Project

Jan 10 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Fixed a warning when building with gcc. Added -fdeclspec when running tests to let them compile on Linux as well.

Jan 10 2019, 7:06 AM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

rebased on current master (there was a conflict in the release notes)

Jan 10 2019, 2:49 AM · Restricted Project

Jan 9 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

I am satisfied with the proposed feature set for now. I will try to run the check on LLVM itself in the next days as a final test. Are there anymore feature requests or changes from your sides?

Jan 9 2019, 6:12 PM · Restricted Project
bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
Jan 9 2019, 6:09 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
  • Removed detailed diagnostic messages why FixIts could not be generated
  • Excluded functions returning member pointers for now
  • All tests run now
Jan 9 2019, 6:08 PM · Restricted Project
bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

I spent some time now to get member pointers as return values working and I am afraid but it seems there is a problem with the clang AST. Given the following code in my check (where F is a FunctionDecl):

const TypeSourceInfo *TSI = F.getTypeSourceInfo();
const FunctionTypeLoc FTL = TSI->getTypeLoc().IgnoreParens().getAs<FunctionTypeLoc>();
auto rl = FTL.getReturnLoc();
rl.getSourceRange().dump(SM);
rl.getLocalSourceRange().dump(SM);
rl.castAs<MemberPointerTypeLoc>().getSourceRange().dump(SM);
rl.castAs<MemberPointerTypeLoc>().getLocalSourceRange().dump(SM);
rl.castAs<MemberPointerTypeLoc>().getBeginLoc().dump(SM);
rl.castAs<MemberPointerTypeLoc>().getStarLoc().dump(SM);

with the following input:

namespace std {
    template <typename T>
    class vector;
Jan 9 2019, 5:38 PM · Restricted Project

Jan 8 2019

bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
Jan 8 2019, 2:22 AM · Restricted Project

Jan 7 2019

bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

@JonasToth Do you really think I should drop the extra information on why I could not provide a FixIt? If truly yes, than I would like to keep them as comments.

Jan 7 2019, 6:04 PM · Restricted Project
bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
Jan 7 2019, 6:02 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Fixed most of the issues pointed out by @JonasToth and added a few more tests. The tests with data member pointers currently fail and I will investiage this.

Jan 7 2019, 6:01 PM · Restricted Project

Jan 6 2019

bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
Jan 6 2019, 4:34 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

Big thank you to @JonasToth for providing some macro test cases. I played a bit with macros and settled on the following behavior:

  • if the closing parenthesis of the function is inside a macro, no FixIt will be created (I cannot relyably lex for subsequent CV and ref qualifiers and maybe we do not want to make changes in macros)
  • if the return type is not CV qualified, i allow macros to be part of it because no lexing is required
  • if the return type is CV qualified and contains macros, I provide no FixIt
Jan 6 2019, 4:29 PM · Restricted Project

Jan 2 2019

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

rebased from release_70 onto master

Jan 2 2019, 5:43 PM · Restricted Project
bernhardmgruber added inline comments to D56160: [clang-tidy] modernize-use-trailing-return-type check.
Jan 2 2019, 4:17 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

added more test cases, allowing check to run on out-of-line definitions and updated docs.

Jan 2 2019, 4:09 PM · Restricted Project
bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.
Jan 2 2019, 2:42 PM · Restricted Project
bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

I fixed most of the stylistic issues. Regarding the missing test cases, I will add those and do the necessary code changes. Thank you very much for pointing them out to me!

Jan 2 2019, 2:42 PM · Restricted Project

Dec 30 2018

bernhardmgruber updated the diff for D56160: [clang-tidy] modernize-use-trailing-return-type check.

updated diff to one with full context

Dec 30 2018, 9:55 AM · Restricted Project
bernhardmgruber added a comment to D56160: [clang-tidy] modernize-use-trailing-return-type check.

This is my first contribution to LLVM and I may not yet know the conventions here.

Dec 30 2018, 9:51 AM · Restricted Project
bernhardmgruber created D56160: [clang-tidy] modernize-use-trailing-return-type check.
Dec 30 2018, 9:45 AM · Restricted Project