diff --git a/clang/lib/Basic/Warnings.cpp b/clang/lib/Basic/Warnings.cpp index cc8c138233ca1d9fcc4ef04840b87fb2efb94655..e938edd04621318f7aed2282cfabad3b80dde3cd 100644 --- a/clang/lib/Basic/Warnings.cpp +++ b/clang/lib/Basic/Warnings.cpp @@ -52,6 +52,30 @@ void clang::ProcessWarningOptions(DiagnosticsEngine &Diags, Diags.setPrintTemplateTree(Opts.ShowTemplateTree); Diags.setShowColors(Opts.ShowColors); + // OHOS LLVM15 migration workaround + { + const std::vector InjectedChecks = { + "no-error=unused-but-set-variable", + "no-error=deprecated-declarations", + "no-error=strict-prototypes", + "no-error=null-pointer-subtraction", + "no-error=unqualified-std-cast-call", + "no-error=unused-but-set-parameter", + "no-error=deprecated-builtins", + "no-error=array-bounds", + "no-error=array-parameter", + "no-error=unused-but-set-variable", + "no-error=reserved-identifier", + "no-error=bitwise-instead-of-logical", + "no-error=strict-prototypes", + "no-error=deprecated-pragma" + }; + + auto& Warnings = const_cast(Opts).Warnings; + Warnings.insert(Warnings.end(), InjectedChecks.begin(), InjectedChecks.end()); + } + + // Handle -ferror-limit if (Opts.ErrorLimit) Diags.setErrorLimit(Opts.ErrorLimit);