brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 3497ea7 Raw
88 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 "AvoidEndlCheck.h"13#include "EnumSizeCheck.h"14#include "FasterStringFindCheck.h"15#include "ForRangeCopyCheck.h"16#include "ImplicitConversionInLoopCheck.h"17#include "InefficientAlgorithmCheck.h"18#include "InefficientStringConcatenationCheck.h"19#include "InefficientVectorOperationCheck.h"20#include "MoveConstArgCheck.h"21#include "MoveConstructorInitCheck.h"22#include "NoAutomaticMoveCheck.h"23#include "NoIntToPtrCheck.h"24#include "NoexceptDestructorCheck.h"25#include "NoexceptMoveConstructorCheck.h"26#include "NoexceptSwapCheck.h"27#include "TriviallyDestructibleCheck.h"28#include "TypePromotionInMathFnCheck.h"29#include "UnnecessaryCopyInitializationCheck.h"30#include "UnnecessaryValueParamCheck.h"31 32namespace clang::tidy {33namespace performance {34 35class PerformanceModule : public ClangTidyModule {36public:37  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {38    CheckFactories.registerCheck<AvoidEndlCheck>("performance-avoid-endl");39    CheckFactories.registerCheck<EnumSizeCheck>("performance-enum-size");40    CheckFactories.registerCheck<FasterStringFindCheck>(41        "performance-faster-string-find");42    CheckFactories.registerCheck<ForRangeCopyCheck>(43        "performance-for-range-copy");44    CheckFactories.registerCheck<ImplicitConversionInLoopCheck>(45        "performance-implicit-conversion-in-loop");46    CheckFactories.registerCheck<InefficientAlgorithmCheck>(47        "performance-inefficient-algorithm");48    CheckFactories.registerCheck<InefficientStringConcatenationCheck>(49        "performance-inefficient-string-concatenation");50    CheckFactories.registerCheck<InefficientVectorOperationCheck>(51        "performance-inefficient-vector-operation");52    CheckFactories.registerCheck<MoveConstArgCheck>(53        "performance-move-const-arg");54    CheckFactories.registerCheck<MoveConstructorInitCheck>(55        "performance-move-constructor-init");56    CheckFactories.registerCheck<NoAutomaticMoveCheck>(57        "performance-no-automatic-move");58    CheckFactories.registerCheck<NoIntToPtrCheck>("performance-no-int-to-ptr");59    CheckFactories.registerCheck<NoexceptDestructorCheck>(60        "performance-noexcept-destructor");61    CheckFactories.registerCheck<NoexceptMoveConstructorCheck>(62        "performance-noexcept-move-constructor");63    CheckFactories.registerCheck<NoexceptSwapCheck>(64        "performance-noexcept-swap");65    CheckFactories.registerCheck<TriviallyDestructibleCheck>(66        "performance-trivially-destructible");67    CheckFactories.registerCheck<TypePromotionInMathFnCheck>(68        "performance-type-promotion-in-math-fn");69    CheckFactories.registerCheck<UnnecessaryCopyInitializationCheck>(70        "performance-unnecessary-copy-initialization");71    CheckFactories.registerCheck<UnnecessaryValueParamCheck>(72        "performance-unnecessary-value-param");73  }74};75 76// Register the PerformanceModule using this statically initialized variable.77static ClangTidyModuleRegistry::Add<PerformanceModule>78    X("performance-module", "Adds performance checks.");79 80} // namespace performance81 82// This anchor is used to force the linker to link in the generated object file83// and thus register the PerformanceModule.84// NOLINTNEXTLINE(misc-use-internal-linkage)85volatile int PerformanceModuleAnchorSource = 0;86 87} // namespace clang::tidy88