author | Andi-Bogdan Postelnicu <bpostelnicu@mozilla.com> |
Thu, 31 Oct 2019 12:16:35 +0000 | |
changeset 500003 | 9d02871eff57f2fcce7c574ad23c1b78f4e1e012 |
parent 500002 | 821295cc8d2dab3ff810b3866cd045e0aed5fa4c |
child 500004 | 79b814f400bb43d53bf5b789a39c611eea0cd901 |
push id | 36750 |
push user | csabou@mozilla.com |
push date | Thu, 31 Oct 2019 16:25:50 +0000 |
treeherder | mozilla-central@9a2e7d38cb07 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | sylvestre |
bugs | 1589096 |
milestone | 72.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
new file mode 100644 --- /dev/null +++ b/build/build-clang/clang-tidy-ci.patch @@ -0,0 +1,26 @@ +diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp +index 1d813d65f8d..5ef2e6fe9cd 100644 +--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp ++++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp +@@ -407,6 +407,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer( + + for (auto &Check : Checks) { + Check->registerMatchers(&*Finder); ++ Check->registerPPCallbacks(Compiler); + Check->registerPPCallbacks(*SM, PP, ModuleExpanderPP); + } + +diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.h b/clang-tools-extra/clang-tidy/ClangTidyCheck.h +index 3064a41caa1..9c7eb4815c4 100644 +--- a/clang-tools-extra/clang-tidy/ClangTidyCheck.h ++++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.h +@@ -53,6 +53,9 @@ public: + /// constructor using the Options.get() methods below. + ClangTidyCheck(StringRef CheckName, ClangTidyContext *Context); + ++ /// This has been deprecated in clang 9 - needed by mozilla-must-override ++ virtual void registerPPCallbacks(CompilerInstance &Compiler) {} ++ + /// \brief Override this to register ``PPCallbacks`` in the preprocessor. + /// + /// This should be used for clang-tidy checks that analyze preprocessor-
--- a/build/build-clang/clang-tidy-linux64.json +++ b/build/build-clang/clang-tidy-linux64.json @@ -5,10 +5,11 @@ "assertions": false, "build_clang_tidy": true, "python_path": "/usr/bin/python2.7", "gcc_dir": "{MOZ_FETCHES_DIR}/gcc", "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc", "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++", "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc", "patches": [ + "clang-tidy-ci.patch" ] }
--- a/build/build-clang/clang-tidy-macosx64.json +++ b/build/build-clang/clang-tidy-macosx64.json @@ -10,11 +10,12 @@ "cc": "{MOZ_FETCHES_DIR}/clang/bin/clang", "cxx": "{MOZ_FETCHES_DIR}/clang/bin/clang++", "as": "{MOZ_FETCHES_DIR}/clang/bin/clang", "ar": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-ar", "ranlib": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-ranlib", "libtool": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-libtool", "ld": "{MOZ_FETCHES_DIR}/clang/bin/clang", "patches": [ + "clang-tidy-ci.patch", "compiler-rt-no-codesign.patch" ] }
--- a/build/build-clang/clang-tidy-win64.json +++ b/build/build-clang/clang-tidy-win64.json @@ -4,10 +4,11 @@ "build_type": "Release", "assertions": false, "build_clang_tidy": true, "python_path": "c:/mozilla-build/python/python.exe", "cc": "cl.exe", "cxx": "cl.exe", "ml": "ml64.exe", "patches": [ + "clang-tidy-ci.patch" ] }
--- a/build/clang-plugin/BaseCheck.h +++ b/build/clang-plugin/BaseCheck.h @@ -7,26 +7,25 @@ class MozContext {}; typedef MozContext ContextType; class BaseCheck : public MatchFinder::MatchCallback { public: BaseCheck(StringRef CheckName, ContextType *Context) {} virtual void registerMatchers(MatchFinder *Finder) {} + virtual void registerPPCallbacks(CompilerInstance &CI) {} virtual void check(const MatchFinder::MatchResult &Result) {} DiagnosticBuilder diag(SourceLocation Loc, StringRef Description, DiagnosticIDs::Level Level = DiagnosticIDs::Warning) { DiagnosticsEngine &Diag = Context->getDiagnostics(); unsigned ID = Diag.getDiagnosticIDs()->getCustomDiagID(Level, Description); return Diag.Report(Loc, ID); } - virtual void registerCompilerInstance(CompilerInstance &CI) {} - private: void run(const MatchFinder::MatchResult &Result) override { Context = Result.Context; check(Result); } private: ASTContext *Context;
--- a/build/clang-plugin/DiagnosticsMatcher.cpp +++ b/build/clang-plugin/DiagnosticsMatcher.cpp @@ -2,12 +2,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "DiagnosticsMatcher.h" DiagnosticsMatcher::DiagnosticsMatcher(CompilerInstance &CI) { #define CHECK(cls, name) \ cls##_.registerMatchers(&AstMatcher); \ - cls##_.registerCompilerInstance(CI); + cls##_.registerPPCallbacks(CI); #include "Checks.inc" #undef CHECK }
--- a/build/clang-plugin/MustOverrideChecker.cpp +++ b/build/clang-plugin/MustOverrideChecker.cpp @@ -4,17 +4,17 @@ #include "MustOverrideChecker.h" #include "CustomMatchers.h" void MustOverrideChecker::registerMatchers(MatchFinder *AstMatcher) { AstMatcher->addMatcher(cxxRecordDecl(isDefinition()).bind("class"), this); } -void MustOverrideChecker::registerCompilerInstance(CompilerInstance &CI) { +void MustOverrideChecker::registerPPCallbacks(CompilerInstance &CI) { this->CI = &CI; } void MustOverrideChecker::check(const MatchFinder::MatchResult &Result) { auto D = Result.Nodes.getNodeAs<CXXRecordDecl>("class"); // Look through all of our immediate bases to find methods that need to be // overridden
--- a/build/clang-plugin/MustOverrideChecker.h +++ b/build/clang-plugin/MustOverrideChecker.h @@ -7,16 +7,16 @@ #include "plugin.h" class MustOverrideChecker : public BaseCheck { public: MustOverrideChecker(StringRef CheckName, ContextType *Context = nullptr) : BaseCheck(CheckName, Context), CI(nullptr) {} void registerMatchers(MatchFinder *AstMatcher) override; - void registerCompilerInstance(CompilerInstance &CI) override; + void registerPPCallbacks(CompilerInstance &CI) override; void check(const MatchFinder::MatchResult &Result) override; private: const CompilerInstance *CI; }; #endif
--- a/build/clang-plugin/plugin.h +++ b/build/clang-plugin/plugin.h @@ -39,25 +39,15 @@ typedef ASTConsumer *ASTConsumerPtr; #define getEndLoc getLocEnd #endif // In order to support running our checks using clang-tidy, we implement a // source compatible base check class called BaseCheck, and we use the // preprocessor to decide which base class to pick. #ifdef CLANG_TIDY #include "../ClangTidy.h" -typedef clang::tidy::ClangTidyCheck UpstreamBaseCheck; +typedef clang::tidy::ClangTidyCheck BaseCheck; typedef clang::tidy::ClangTidyContext ContextType; - -class BaseCheck : public UpstreamBaseCheck { -public: - BaseCheck(StringRef CheckName, ContextType *Context = nullptr) - : UpstreamBaseCheck(CheckName, Context) {} - - // Additional functionality needed by Mozilla code - virtual void registerCompilerInstance(CompilerInstance &CI) {} -}; - #else #include "BaseCheck.h" #endif #endif // plugin_h__