[PATCH] D76818: [clang-tidy] Add check llvmlibc-implementation-in-namespace.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 26 08:06:15 PDT 2020


njames93 added a comment.

If you want to make it a general check, you should consider making the default module options set the correct namespace
RequiredNamespace

  ClangTidyOptions getModuleOptions() override {
    ClangTidyOptions Options;
    Options.CheckOptions["llvmlibc-implementation-in-namespace.RequiredNamespace"] = "__llvm_libc";
    return Options;
  }



================
Comment at: clang-tools-extra/test/clang-tidy/checkers/llvmlibc-implementation-in-namespace.cpp:6
+class ClassB;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: CXXRecord is not defined in a namespace, please wrap implentation in '__llvm_libc' namespace.
+struct StructC {};
----------------
Small nit : Not a fan of the diagnostic saying `CXX Record`. Maybe a pain but `getDeclKindName` isn't the best to expose to users. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76818





More information about the cfe-commits mailing list