The check currently erroneously flags typedefs in extern "C" blocks.
Addresses https://bugs.llvm.org/show_bug.cgi?id=49181
Details
- Reviewers
aaron.ballman alexfh steveire
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp | ||
---|---|---|
305 | Can you add tests for typedefs in other scopes like extern "C" { typedef int CType; struct CAnother { }; typedef struct { int b; typedef struct CAnother AStruct; } CStruct; void foo() { typedef struct CAnother AStruct; } } |
clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp | ||
---|---|---|
305 | I'm not sure those tests add any value. For the struct, you can't have a typedef in a struct in c. The function typedef is valid in c, but I still can't see a reason to use extern C when defining a function in c++ |
clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp | ||
---|---|---|
19 | This matcher may be useful for other checks, for example, modernize-use-nullptr. |
clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp | ||
---|---|---|
305 | Fair enough - Clang accepts the typedef in the struct with a warning, but it doesn't get transformed by the check anyway. The one in the function doesn't get transformed either, and if functions are so unlikely to appear in extern C, that it doesn't need to be covered, that's fine with me. |
clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp | ||
---|---|---|
305 |
There are a few reasons.
So it definitely does happen in the wild. As some examples: https://codesearch.isocpp.org/actcd19/main/b/bali-phy/bali-phy_3.4+dfsg-1/src/builtins/SModel.cc |
This matcher may be useful for other checks, for example, modernize-use-nullptr.