Alexander Kornienko ab2d3ce47d [clang-tidy] Applied clang-tidy fixes. NFC
Applied fixes enabled by the LLVM's .clang-tidy configs. Reverted files where
fixes introduced compile errors:
  clang-tools-extra/clang-tidy/hicpp/NoAssemblerCheck.cpp
  clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp

$ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -fix clang-tools-extra/clang-tidy/
Enabled checks:
    llvm-else-after-return
    llvm-header-guard
    llvm-include-order
    llvm-namespace-comment
    llvm-prefer-isa-or-dyn-cast-in-conditionals
    llvm-prefer-register-over-unsigned
    llvm-qualified-auto
    llvm-twine-local
    misc-definitions-in-headers
    misc-misplaced-const
    misc-new-delete-overloads
    misc-no-recursion
    misc-non-copyable-objects
    misc-redundant-expression
    misc-static-assert
    misc-throw-by-value-catch-by-reference
    misc-unconventional-assign-operator
    misc-uniqueptr-reset-release
    misc-unused-alias-decls
    misc-unused-using-decls
    readability-identifier-naming

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D95614
2021-01-29 01:01:19 +01:00

74 lines
2.9 KiB
C++

//===--- AndroidTidyModule.cpp - clang-tidy--------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "../ClangTidyModuleRegistry.h"
#include "CloexecAccept4Check.h"
#include "CloexecAcceptCheck.h"
#include "CloexecCreatCheck.h"
#include "CloexecDupCheck.h"
#include "CloexecEpollCreate1Check.h"
#include "CloexecEpollCreateCheck.h"
#include "CloexecFopenCheck.h"
#include "CloexecInotifyInit1Check.h"
#include "CloexecInotifyInitCheck.h"
#include "CloexecMemfdCreateCheck.h"
#include "CloexecOpenCheck.h"
#include "CloexecPipe2Check.h"
#include "CloexecPipeCheck.h"
#include "CloexecSocketCheck.h"
#include "ComparisonInTempFailureRetryCheck.h"
using namespace clang::ast_matchers;
namespace clang {
namespace tidy {
namespace android {
/// This module is for Android specific checks.
class AndroidModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck<CloexecAccept4Check>("android-cloexec-accept4");
CheckFactories.registerCheck<CloexecAcceptCheck>("android-cloexec-accept");
CheckFactories.registerCheck<CloexecCreatCheck>("android-cloexec-creat");
CheckFactories.registerCheck<CloexecDupCheck>("android-cloexec-dup");
CheckFactories.registerCheck<CloexecEpollCreate1Check>(
"android-cloexec-epoll-create1");
CheckFactories.registerCheck<CloexecEpollCreateCheck>(
"android-cloexec-epoll-create");
CheckFactories.registerCheck<CloexecFopenCheck>("android-cloexec-fopen");
CheckFactories.registerCheck<CloexecInotifyInit1Check>(
"android-cloexec-inotify-init1");
CheckFactories.registerCheck<CloexecInotifyInitCheck>(
"android-cloexec-inotify-init");
CheckFactories.registerCheck<CloexecMemfdCreateCheck>(
"android-cloexec-memfd-create");
CheckFactories.registerCheck<CloexecOpenCheck>("android-cloexec-open");
CheckFactories.registerCheck<CloexecPipeCheck>("android-cloexec-pipe");
CheckFactories.registerCheck<CloexecPipe2Check>("android-cloexec-pipe2");
CheckFactories.registerCheck<CloexecSocketCheck>("android-cloexec-socket");
CheckFactories.registerCheck<ComparisonInTempFailureRetryCheck>(
"android-comparison-in-temp-failure-retry");
}
};
// Register the AndroidTidyModule using this statically initialized variable.
static ClangTidyModuleRegistry::Add<AndroidModule>
X("android-module", "Adds Android platform checks.");
} // namespace android
// This anchor is used to force the linker to link in the generated object file
// and thus register the AndroidModule.
volatile int AndroidModuleAnchorSource = 0;
} // namespace tidy
} // namespace clang