11ee1f493SJulie Hockett //===--- StaticallyConstructedObjectsCheck.h - clang-tidy--------*- C++ -*-===// 21ee1f493SJulie Hockett // 32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61ee1f493SJulie Hockett // 71ee1f493SJulie Hockett //===----------------------------------------------------------------------===// 81ee1f493SJulie Hockett 91ee1f493SJulie Hockett #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FUCHSIA_STATICALLY_CONSTRUCTED_OBJECTS_H 101ee1f493SJulie Hockett #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FUCHSIA_STATICALLY_CONSTRUCTED_OBJECTS_H 111ee1f493SJulie Hockett 12478fc5c8SAlexander Kornienko #include "../ClangTidyCheck.h" 131ee1f493SJulie Hockett 14*4718da50SCarlos Galvez namespace clang::tidy::fuchsia { 151ee1f493SJulie Hockett 161ee1f493SJulie Hockett /// Constructing global, non-trivial objects with static storage is 171ee1f493SJulie Hockett /// disallowed, unless the object is statically initialized with a constexpr 181ee1f493SJulie Hockett /// constructor or has no explicit constructor. 191ee1f493SJulie Hockett /// 201ee1f493SJulie Hockett /// For the user-facing documentation see: 216e566bc5SRichard /// http://clang.llvm.org/extra/clang-tidy/checks/fuchsia/statically-constructed-objects.html 221ee1f493SJulie Hockett class StaticallyConstructedObjectsCheck : public ClangTidyCheck { 231ee1f493SJulie Hockett public: StaticallyConstructedObjectsCheck(StringRef Name,ClangTidyContext * Context)241ee1f493SJulie Hockett StaticallyConstructedObjectsCheck(StringRef Name, ClangTidyContext *Context) 251ee1f493SJulie Hockett : ClangTidyCheck(Name, Context) {} isLanguageVersionSupported(const LangOptions & LangOpts)26e40a742aSNathan James bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { 27e40a742aSNathan James return LangOpts.CPlusPlus11; 28e40a742aSNathan James } 291ee1f493SJulie Hockett void registerMatchers(ast_matchers::MatchFinder *Finder) override; 301ee1f493SJulie Hockett void check(const ast_matchers::MatchFinder::MatchResult &Result) override; 311ee1f493SJulie Hockett }; 321ee1f493SJulie Hockett 33*4718da50SCarlos Galvez } // namespace clang::tidy::fuchsia 341ee1f493SJulie Hockett 351ee1f493SJulie Hockett #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FUCHSIA_STATICALLY_CONSTRUCTED_OBJECTS_H 36