Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modernize-use-using problems: template types, namespaces #28708

Closed
EugeneZelenko opened this issue Jun 27, 2016 · 13 comments
Closed

modernize-use-using problems: template types, namespaces #28708

EugeneZelenko opened this issue Jun 27, 2016 · 13 comments
Labels
bugzilla Issues migrated from bugzilla clang-tidy

Comments

@EugeneZelenko
Copy link
Contributor

Bugzilla Link 28334
Resolution FIXED
Resolved on Apr 02, 2017 12:30
Version unspecified
OS Linux
CC @pepsiman

Extended Description

Looks like modernize-use-using suggest to replace type from template parameters with actual type passed to template.

To reproduce run check over LLVM code base with -header-filter=".*" and search include/llvm/ADT/SmallPtrSet.h:237:3.

@EugeneZelenko
Copy link
Contributor Author

Other encountered problem: namespace is inserted when template is located in llvm namespace.

include/llvm/Support/CommandLine.h:478:3: warning: use 'using' instead of 'typedef' [modernize-use-using]
typedef StringRef WrapperType;
^
using WrapperType = llvm::StringRef

@EugeneZelenko
Copy link
Contributor Author

Constants defined in enum is replaced with actual value in fix-it:

tools/clang/include/clang/Basic/AddressSpaces.h:45:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
typedef unsigned Map[Count];
^
using Map = unsigned int [7]

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 19, 2016

There is also other thing that Krystyna told me about:
It gives many warnings when you use some macro that uses typedefs inside like the ones in gtest. Perhaps there it should warn about ones in macros only when some special option is enabled.

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 2, 2016

Piotr, do you know whether Krystyna is planning to work on this?

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 2, 2016

We don't work together because she is moving to another city. I remember that she said that she is planning to fix it sometime, but I don't think it will be in next 2 months. I know she is not doing any work right now.

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 4, 2016

I'm planning to fix this, but I do not have possibility to do it before second half of September because I do not have a good computer right now.

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 4, 2016

Krystyna, thank you for the information! I'm assigning the issue to you then. Feel free to unassign, if you realize that you're not going to work on this.

@pepsiman
Copy link
Contributor

pepsiman commented Sep 6, 2016

Another problem:

typedef.cpp:1:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
typedef struct foo_s { int i; } * foo_t;
^
using foo_t = struct foo_s *

I'd expect the fixit to create this:

struct foo_s { int i; };
using foo_t = foo_s *;

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 24, 2017

Another problem:

typedef.cpp:1:1: warning: use 'using' instead of 'typedef'
[modernize-use-using]
typedef struct foo_s { int i; } * foo_t;
^
using foo_t = struct foo_s *

I'd expect the fixit to create this:

struct foo_s { int i; };
using foo_t = foo_s *;

I've added a workaround for this in r292918. Actually, it would be more convenient to have a separate bug for each of these issues with isolated and reduced test cases.

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 24, 2017

Please file a separate bug with a corresponding isolated test case for each of these issues.

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 29, 2017

Looks like modernize-use-using suggest to replace type from template
parameters with actual type passed to template.

To reproduce run check over LLVM code base with -header-filter=".*" and
search include/llvm/ADT/SmallPtrSet.h:237:3.

I was not able to reproduce this problem. In the line 280 (which was previously 237 line) code:

template
class SmallPtrSetIterator : public SmallPtrSetIteratorImpl {

public:
typedef PtrTy reference;
}

is changed to:

template
class SmallPtrSetIterator : public SmallPtrSetIteratorImpl {

public:
using reference = PtrTy;

}

Can you try to reproduce this error once again and open a bug if you find it?

@EugeneZelenko
Copy link
Contributor Author

Alexander did some fixes in r292918. May be this problem was fixed there?

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 30, 2017

Solutions for some bugs in https://reviews.llvm.org/D29262

Remaining bug is now in: https://llvm.org/bugs/show_bug.cgi?id=31793

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy
Projects
None yet
Development

No branches or pull requests

3 participants