[PATCH] D97361: [clang-tidy] Add readability-redundant-using check

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 06:42:03 PST 2021


njames93 added a comment.

Can you override the `isLanguageVersionSupported` method to ensure this check only runs over c++ code.
Can you add some macro tests, typically we err on the side of caution and don't emit any fixes for macro code. You can use `SourceLocation::IsMacroID()` to detect macro expansions.
The description looks to have an error in the 2nd example, guess you are messing 'n' after the namespace.
How will this handle inline namespaces.

  namespace N {
  inline namespace M {
  void foo();
  void bar();
  } // namespace M
  inline namespace O {
  void bar();
  }
  using M::foo; // This is redundant.
  using M::bar; // This is gonna give you a hard time.
  } // namespace N



================
Comment at: clang-tools-extra/clang-tidy/readability/RedundantUsingCheck.cpp:62
+}
+void RedundantUsingCheck::diagUsing(int Type, const Decl *Using,
+                                    const NamedDecl *ND,
----------------
nit: New line between methods.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97361



More information about the cfe-commits mailing list