[PATCH] D113804: [clang-tidy] Fix behavior of `modernize-use-using` with nested structs/unions

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 15 04:27:02 PST 2021


whisperity added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/UseUsingCheck.h:27
   SourceLocation LastReplacementEnd;
-  SourceRange LastTagDeclRange;
+  std::map<const Decl *, SourceRange> LastTagDeclRanges;
+
----------------
Considering the pointer is just a number that hashes well, is there a reason to use the plain `std::map`? It is [[ https://llvm.org/docs/ProgrammersManual.html#map | generally discouraged ]].


================
Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp:305-308
+
+typedef struct { int a; union { int b; }; } PR50990;
+// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using PR50990 = struct { int a; union { int b; }; };
----------------
Just for the sake of testing a new logic, it would be beneficial to add a "more complex" nested example. At least one example where there are two sibling nests, and one where there is an additional level of nesting.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113804/new/

https://reviews.llvm.org/D113804



More information about the cfe-commits mailing list