brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 411d252 Raw
59 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "../ClangTidy.h"10#include "../ClangTidyModule.h"11#include "../ClangTidyModuleRegistry.h"12#include "AssertEqualsCheck.h"13#include "AvoidNSErrorInitCheck.h"14#include "DeallocInCategoryCheck.h"15#include "ForbiddenSubclassingCheck.h"16#include "MissingHashCheck.h"17#include "NSDateFormatterCheck.h"18#include "NSInvocationArgumentLifetimeCheck.h"19#include "PropertyDeclarationCheck.h"20#include "SuperSelfCheck.h"21 22using namespace clang::ast_matchers;23 24namespace clang::tidy {25namespace objc {26 27class ObjCModule : public ClangTidyModule {28public:29  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {30    CheckFactories.registerCheck<AvoidNSErrorInitCheck>(31        "objc-avoid-nserror-init");32    CheckFactories.registerCheck<AssertEqualsCheck>("objc-assert-equals");33 34    CheckFactories.registerCheck<DeallocInCategoryCheck>(35        "objc-dealloc-in-category");36    CheckFactories.registerCheck<ForbiddenSubclassingCheck>(37        "objc-forbidden-subclassing");38    CheckFactories.registerCheck<MissingHashCheck>("objc-missing-hash");39    CheckFactories.registerCheck<NSDateFormatterCheck>("objc-nsdate-formatter");40    CheckFactories.registerCheck<NSInvocationArgumentLifetimeCheck>(41        "objc-nsinvocation-argument-lifetime");42    CheckFactories.registerCheck<PropertyDeclarationCheck>(43        "objc-property-declaration");44    CheckFactories.registerCheck<SuperSelfCheck>("objc-super-self");45  }46};47 48// Register the ObjCTidyModule using this statically initialized variable.49static ClangTidyModuleRegistry::Add<ObjCModule>50    X("objc-module", "Adds Objective-C lint checks.");51 52} // namespace objc53 54// This anchor is used to force the linker to link in the generated object file55// and thus register the ObjCModule.56volatile int ObjCModuleAnchorSource = 0; // NOLINT(misc-use-internal-linkage)57 58} // namespace clang::tidy59