2018-03-08 00:57:42 +08:00
|
|
|
//===--- PortabilityTidyModule.cpp - clang-tidy ---------------------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2018-03-08 00:57:42 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "../ClangTidy.h"
|
|
|
|
#include "../ClangTidyModule.h"
|
|
|
|
#include "../ClangTidyModuleRegistry.h"
|
[clang-tidy] Move fuchsia-restrict-system-includes to portability module for general use.
Summary:
Created a general check for restrict-system-includes under portability as recommend in the comments under D75332. I also fleshed out the user facing documentation to show examples for common use-cases such as allow-list, block-list, and wild carding.
Removed fuchsia's check as per phosek sugguestion.
Reviewers: aaron.ballman, phosek, alexfh, hokein, njames93
Reviewed By: phosek
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, phosek, cfe-commits, MaskRay
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D75786
2020-03-11 01:28:23 +08:00
|
|
|
#include "RestrictSystemIncludesCheck.h"
|
2018-03-08 00:57:42 +08:00
|
|
|
#include "SIMDIntrinsicsCheck.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
namespace portability {
|
|
|
|
|
|
|
|
class PortabilityModule : public ClangTidyModule {
|
|
|
|
public:
|
|
|
|
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
|
[clang-tidy] Move fuchsia-restrict-system-includes to portability module for general use.
Summary:
Created a general check for restrict-system-includes under portability as recommend in the comments under D75332. I also fleshed out the user facing documentation to show examples for common use-cases such as allow-list, block-list, and wild carding.
Removed fuchsia's check as per phosek sugguestion.
Reviewers: aaron.ballman, phosek, alexfh, hokein, njames93
Reviewed By: phosek
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, phosek, cfe-commits, MaskRay
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D75786
2020-03-11 01:28:23 +08:00
|
|
|
CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
|
|
|
|
"portability-restrict-system-includes");
|
2018-03-08 00:57:42 +08:00
|
|
|
CheckFactories.registerCheck<SIMDIntrinsicsCheck>(
|
|
|
|
"portability-simd-intrinsics");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Register the PortabilityModule using this statically initialized variable.
|
|
|
|
static ClangTidyModuleRegistry::Add<PortabilityModule>
|
|
|
|
X("portability-module", "Adds portability-related checks.");
|
|
|
|
|
|
|
|
} // namespace portability
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link in the generated object file
|
|
|
|
// and thus register the PortabilityModule.
|
|
|
|
volatile int PortabilityModuleAnchorSource = 0;
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|