[PATCH] D65919: [clang-tidy] Add llvm-prefer-register-over-unsigned check and apply it to LLVM

Daniel Sanders via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 19:03:28 PDT 2019


dsanders marked 4 inline comments as done.
dsanders added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp:48-51
+    for (const auto *UsingDirective: Context->using_directives())
+      if (UsingDirective->getNominatedNamespace()
+              ->getQualifiedNameAsString() == "llvm")
+        Replacement = "Register";
----------------
There's something not quite right here but I haven't figured out what yet. One of the tests (apply_2()) is failing (which is odd because I ran `ninja check-clang-tools` before posting the patch) because the `using namespace llvm` in the function scope doesn't show up in the DeclContext for the function. Am I looking in the wrong place for it?

More generally, I suspect there's an easier way to omit the `llvm::` than the way I'm using on lines 43-52.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65919





More information about the cfe-commits mailing list