Index: docs/ReleaseNotes.rst =================================================================== --- docs/ReleaseNotes.rst +++ docs/ReleaseNotes.rst @@ -51,6 +51,10 @@ Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- ``-wtest`` flag was added. It is advised to pass it when building tests. + It disables some diagnostics for code that is very likely intentional in + tests, but is an issue elsewhere, e.g. self-assignment (``-Wself-assign``). + - ``-Wc++98-compat-extra-semi`` is a new flag, which was previously inseparable from ``-Wc++98-compat-pedantic``. The latter still controls the new flag. @@ -62,8 +66,9 @@ - ``-Wself-assign`` and ``-Wself-assign-field`` were extended to diagnose self-assignment operations using overloaded operators (i.e. classes). If you are doing such an assignment intentionally, e.g. in a unit test for - a data structure, the warning can be suppressed by adding ``*&`` to the - right-hand side or casting it to the appropriate reference type. + a data structure, the ``-Wself-assign`` warning can be suppressed by + passing ``-wtest`` flag, or adding ``*&`` to the right-hand side or + casting it to the appropriate reference type. Non-comprehensive list of changes in this release ------------------------------------------------- Index: docs/UsersManual.rst =================================================================== --- docs/UsersManual.rst +++ docs/UsersManual.rst @@ -123,6 +123,10 @@ Disable all diagnostics. +.. option:: -wtest + + Disable some diagnostics that are very likely a false-positives in test code. + .. option:: -Weverything :ref:`Enable all diagnostics. ` Index: include/clang/AST/ASTDiagnostic.h =================================================================== --- include/clang/AST/ASTDiagnostic.h +++ include/clang/AST/ASTDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define ASTSTART #include "clang/Basic/DiagnosticASTKinds.inc" #undef DIAG Index: include/clang/AST/CommentDiagnostic.h =================================================================== --- include/clang/AST/CommentDiagnostic.h +++ include/clang/AST/CommentDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define COMMENTSTART #include "clang/Basic/DiagnosticCommentKinds.inc" #undef DIAG Index: include/clang/Basic/Diagnostic.h =================================================================== --- include/clang/Basic/Diagnostic.h +++ include/clang/Basic/Diagnostic.h @@ -272,13 +272,16 @@ // Suppress warnings in system headers. unsigned SuppressSystemWarnings : 1; + // Suppress some warnings that are false-positives for tests. + unsigned TailorForTests : 1; + // Map extensions to warnings or errors? diag::Severity ExtBehavior = diag::Severity::Ignored; DiagState() : IgnoreAllWarnings(false), EnableAllWarnings(false), WarningsAsErrors(false), ErrorsAsFatal(false), - SuppressSystemWarnings(false) {} + SuppressSystemWarnings(false), TailorForTests(false) {} using iterator = llvm::DenseMap::iterator; using const_iterator = @@ -626,7 +629,12 @@ return GetCurDiagState()->SuppressSystemWarnings; } - /// \brief Suppress all diagnostics, to silence the front end when we + /// \brief When set to true some warnings that are likely to be + /// false-positives in tests are not issued. + void setTailorForTests(bool Val) { GetCurDiagState()->TailorForTests = Val; } + bool getTailorForTests() const { return GetCurDiagState()->TailorForTests; } + + /// \brief Suppress all diagnostics, to silence the front end when we /// know that we don't want any more diagnostics to be passed along to the /// client void setSuppressAllDiagnostics(bool Val = true) { Index: include/clang/Basic/Diagnostic.td =================================================================== --- include/clang/Basic/Diagnostic.td +++ include/clang/Basic/Diagnostic.td @@ -75,6 +75,7 @@ bit AccessControl = 0; bit WarningNoWerror = 0; bit ShowInSystemHeader = 0; + bit HideInTests = 0; Severity DefaultSeverity = defaultmapping; DiagGroup Group; string CategoryName = ""; @@ -98,6 +99,14 @@ bit ShowInSystemHeader = 0; } +class ShowInTests { + bit HideInTests = 0; +} + +class SuppressInTests { + bit HideInTests = 1; +} + // FIXME: ExtWarn and Extension should also be SFINAEFailure by default. class Error : Diagnostic, SFINAEFailure { bit ShowInSystemHeader = 1; Index: include/clang/Basic/DiagnosticIDs.h =================================================================== --- include/clang/Basic/DiagnosticIDs.h +++ include/clang/Basic/DiagnosticIDs.h @@ -65,8 +65,9 @@ // Get typedefs for common diagnostics. enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,CATEGORY,NOWERROR,SHOWINSYSHEADER) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, CATEGORY, \ + NOWERROR, SHOWINSYSHEADER, HIDEINTESTS) \ + ENUM, #define COMMONSTART #include "clang/Basic/DiagnosticCommonKinds.inc" NUM_BUILTIN_COMMON_DIAGNOSTICS Index: include/clang/Basic/DiagnosticOptions.def =================================================================== --- include/clang/Basic/DiagnosticOptions.def +++ include/clang/Basic/DiagnosticOptions.def @@ -45,6 +45,7 @@ #endif SEMANTIC_DIAGOPT(IgnoreWarnings, 1, 0) /// -w +SEMANTIC_DIAGOPT(TailorForTest, 1, 0) /// -wtest DIAGOPT(NoRewriteMacros, 1, 0) /// -Wno-rewrite-macros DIAGOPT(Pedantic, 1, 0) /// -pedantic DIAGOPT(PedanticErrors, 1, 0) /// -pedantic-errors Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -5600,9 +5600,11 @@ "operator '%0' has lower precedence than '%1'; " "'%1' will be evaluated first">, InGroup; -def warn_self_assignment : Warning< +def warn_self_assignment_builtin : Warning< "explicitly assigning value of variable of type %0 to itself">, InGroup, DefaultIgnore; +def warn_self_assignment_overloaded: Warning, + InGroup, DefaultIgnore, SuppressInTests; def warn_self_move : Warning< "explicitly moving variable of type %0 to itself">, InGroup, DefaultIgnore; Index: include/clang/CrossTU/CrossTUDiagnostic.h =================================================================== --- include/clang/CrossTU/CrossTUDiagnostic.h +++ include/clang/CrossTU/CrossTUDiagnostic.h @@ -16,7 +16,7 @@ namespace diag { enum { #define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ - SHOWINSYSHEADER, CATEGORY) \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ ENUM, #define CROSSTUSTART #include "clang/Basic/DiagnosticCrossTUKinds.inc" Index: include/clang/Driver/DriverDiagnostic.h =================================================================== --- include/clang/Driver/DriverDiagnostic.h +++ include/clang/Driver/DriverDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define DRIVERSTART #include "clang/Basic/DiagnosticDriverKinds.inc" #undef DIAG Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2364,6 +2364,7 @@ def weak__reference__mismatches : Separate<["-"], "weak_reference_mismatches">; def whatsloaded : Flag<["-"], "whatsloaded">; def whyload : Flag<["-"], "whyload">; +def wtest : Flag<["-"], "wtest">, HelpText<"Disable some diagnostics that are likely false-positives in tests">, Flags<[CC1Option]>; def w : Flag<["-"], "w">, HelpText<"Suppress all warnings">, Flags<[CC1Option]>; def x : JoinedOrSeparate<["-"], "x">, Flags<[DriverOption,CC1Option]>, HelpText<"Treat subsequent input files as having type ">, Index: include/clang/Frontend/FrontendDiagnostic.h =================================================================== --- include/clang/Frontend/FrontendDiagnostic.h +++ include/clang/Frontend/FrontendDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define FRONTENDSTART #include "clang/Basic/DiagnosticFrontendKinds.inc" #undef DIAG Index: include/clang/Lex/LexDiagnostic.h =================================================================== --- include/clang/Lex/LexDiagnostic.h +++ include/clang/Lex/LexDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define LEXSTART #include "clang/Basic/DiagnosticLexKinds.inc" #undef DIAG Index: include/clang/Parse/ParseDiagnostic.h =================================================================== --- include/clang/Parse/ParseDiagnostic.h +++ include/clang/Parse/ParseDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define PARSESTART #include "clang/Basic/DiagnosticParseKinds.inc" #undef DIAG Index: include/clang/Sema/SemaDiagnostic.h =================================================================== --- include/clang/Sema/SemaDiagnostic.h +++ include/clang/Sema/SemaDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define SEMASTART #include "clang/Basic/DiagnosticSemaKinds.inc" #undef DIAG Index: include/clang/Serialization/SerializationDiagnostic.h =================================================================== --- include/clang/Serialization/SerializationDiagnostic.h +++ include/clang/Serialization/SerializationDiagnostic.h @@ -15,8 +15,9 @@ namespace clang { namespace diag { enum { -#define DIAG(ENUM,FLAGS,DEFAULT_MAPPING,DESC,GROUP,\ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) ENUM, +#define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + ENUM, #define SERIALIZATIONSTART #include "clang/Basic/DiagnosticSerializationKinds.inc" #undef DIAG Index: include/clang/Tooling/Refactoring/RefactoringDiagnostic.h =================================================================== --- include/clang/Tooling/Refactoring/RefactoringDiagnostic.h +++ include/clang/Tooling/Refactoring/RefactoringDiagnostic.h @@ -17,7 +17,7 @@ namespace diag { enum { #define DIAG(ENUM, FLAGS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ - SHOWINSYSHEADER, CATEGORY) \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ ENUM, #define REFACTORINGSTART #include "clang/Basic/DiagnosticRefactoringKinds.inc" Index: lib/Basic/DiagnosticIDs.cpp =================================================================== --- lib/Basic/DiagnosticIDs.cpp +++ lib/Basic/DiagnosticIDs.cpp @@ -43,6 +43,7 @@ unsigned SFINAE : 2; unsigned WarnNoWerror : 1; unsigned WarnShowInSystemHeader : 1; + unsigned WarnHideInTests : 1; unsigned Category : 6; uint16_t OptionGroupIndex; @@ -96,12 +97,10 @@ static const StaticDiagInfoRec StaticDiagInfo[] = { #define DIAG(ENUM, CLASS, DEFAULT_SEVERITY, DESC, GROUP, SFINAE, NOWERROR, \ - SHOWINSYSHEADER, CATEGORY) \ - { \ - diag::ENUM, DEFAULT_SEVERITY, CLASS, DiagnosticIDs::SFINAE, NOWERROR, \ - SHOWINSYSHEADER, CATEGORY, GROUP, STR_SIZE(DESC, uint16_t), DESC \ - } \ - , + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + {diag::ENUM, DEFAULT_SEVERITY, CLASS, DiagnosticIDs::SFINAE, \ + NOWERROR, SHOWINSYSHEADER, HIDEINTESTS, CATEGORY, \ + GROUP, STR_SIZE(DESC, uint16_t), DESC}, #include "clang/Basic/DiagnosticCommonKinds.inc" #include "clang/Basic/DiagnosticDriverKinds.inc" #include "clang/Basic/DiagnosticFrontendKinds.inc" @@ -489,6 +488,11 @@ Diag.getSourceManager().getExpansionLoc(Loc))) return diag::Severity::Ignored; + // Don't show some diagnostics when -wtest is passed. + if (State->TailorForTests && GetDiagInfo(DiagID) && + GetDiagInfo(DiagID)->WarnHideInTests && Loc.isValid()) + return diag::Severity::Ignored; + return Result; } Index: lib/Basic/Warnings.cpp =================================================================== --- lib/Basic/Warnings.cpp +++ lib/Basic/Warnings.cpp @@ -45,6 +45,7 @@ const DiagnosticOptions &Opts, bool ReportDiags) { Diags.setSuppressSystemWarnings(true); // Default to -Wno-system-headers + Diags.setTailorForTests(Opts.TailorForTest); Diags.setIgnoreAllWarnings(Opts.IgnoreWarnings); Diags.setShowOverloads(Opts.getShowOverloads()); @@ -114,7 +115,7 @@ Diags.setSuppressSystemWarnings(!isPositive); continue; } - + // -Weverything is a special case as well. It implicitly enables all // warnings, including ones not explicitly in a warning group. if (Opt == "everything") { Index: lib/Driver/Driver.cpp =================================================================== --- lib/Driver/Driver.cpp +++ lib/Driver/Driver.cpp @@ -892,6 +892,9 @@ // Silence driver warnings if requested Diags.setIgnoreAllWarnings(Args.hasArg(options::OPT_w)); + // Silence some warnings that are likely false-positives in tests. + Diags.setTailorForTests(Args.hasArg(options::OPT_wtest)); + // -no-canonical-prefixes is used very early in main. Args.ClaimAllArgs(options::OPT_no_canonical_prefixes); Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -1195,6 +1195,7 @@ Args.getLastArg(OPT_diagnostic_serialized_file, OPT__serialize_diags)) Opts.DiagnosticSerializationFile = A->getValue(); Opts.IgnoreWarnings = Args.hasArg(OPT_w); + Opts.TailorForTest = Args.hasArg(OPT_wtest); Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros); Opts.Pedantic = Args.hasArg(OPT_pedantic); Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors); Index: lib/Sema/SemaExpr.cpp =================================================================== --- lib/Sema/SemaExpr.cpp +++ lib/Sema/SemaExpr.cpp @@ -11497,7 +11497,7 @@ /// DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself. /// This warning suppressed in the event of macro expansions. static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr, - SourceLocation OpLoc) { + SourceLocation OpLoc, bool IsBuiltin) { if (S.inTemplateInstantiation()) return; if (S.isUnevaluatedContext()) @@ -11524,9 +11524,10 @@ if (RefTy->getPointeeType().isVolatileQualified()) return; - S.Diag(OpLoc, diag::warn_self_assignment) - << LHSDeclRef->getType() - << LHSExpr->getSourceRange() << RHSExpr->getSourceRange(); + S.Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin + : diag::warn_self_assignment_overloaded) + << LHSDeclRef->getType() << LHSExpr->getSourceRange() + << RHSExpr->getSourceRange(); } /// Check if a bitwise-& is performed on an Objective-C pointer. This @@ -11719,7 +11720,7 @@ OK = LHS.get()->getObjectKind(); } if (!ResultTy.isNull()) { - DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc); + DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc, true); DiagnoseSelfMove(LHS.get(), RHS.get(), OpLoc); } RecordModifiableNonNullParam(*this, LHS.get()); @@ -11817,7 +11818,7 @@ break; case BO_AndAssign: case BO_OrAssign: // fallthrough - DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc); + DiagnoseSelfAssignment(*this, LHS.get(), RHS.get(), OpLoc, true); LLVM_FALLTHROUGH; case BO_XorAssign: CompResultTy = CheckBitwiseOperands(LHS, RHS, OpLoc, Opc); @@ -12124,7 +12125,7 @@ case BO_AndAssign: case BO_OrAssign: case BO_XorAssign: - DiagnoseSelfAssignment(S, LHS, RHS, OpLoc); + DiagnoseSelfAssignment(S, LHS, RHS, OpLoc, false); CheckIdentityFieldAssignment(LHS, RHS, OpLoc, S); break; default: Index: test/Sema/warn-self-assign-builtin-warn-test.c =================================================================== --- /dev/null +++ test/Sema/warn-self-assign-builtin-warn-test.c @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wself-assign -wtest -verify %s + +void var() { + int a; +#ifndef SILENCE + a = a; // expected-warning{{explicitly assigning}} +#else + // expected-no-diagnostics + a = a; +#endif +} + +struct S {}; + +void str() { + struct S a; +#ifndef SILENCE + a = a; // expected-warning{{explicitly assigning}} +#else + // expected-no-diagnostics + a = a; +#endif +} Index: test/SemaCXX/warn-self-assign-builtin-warn-test.cpp =================================================================== --- /dev/null +++ test/SemaCXX/warn-self-assign-builtin-warn-test.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wself-assign -wtest -verify %s + +void f() { + int a; +#ifndef SILENCE + a = a; // expected-warning{{explicitly assigning}} +#else + // expected-no-diagnostics + a = a; +#endif +} Index: test/SemaCXX/warn-self-assign-field-builtin-warn-test.cpp =================================================================== --- /dev/null +++ test/SemaCXX/warn-self-assign-field-builtin-warn-test.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -Wself-assign-field -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wself-assign-field -wtest -verify %s + +struct C { + int a; + + void f() { +#ifndef SILENCE + a = a; // expected-warning{{assigning field to itself}} +#else + // expected-no-diagnostics + a = a; +#endif + } +}; Index: test/SemaCXX/warn-self-assign-field-overloaded-warn-test.cpp =================================================================== --- /dev/null +++ test/SemaCXX/warn-self-assign-field-overloaded-warn-test.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -Wself-assign-field -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wself-assign-field -wtest -verify %s + +struct S {}; + +struct C { + S a; + + void f() { +#ifndef SILENCE + a = a; // expected-warning{{assigning field to itself}} +#else + // expected-no-diagnostics + a = a; +#endif + } +}; Index: test/SemaCXX/warn-self-assign-overloaded-warn-test.cpp =================================================================== --- /dev/null +++ test/SemaCXX/warn-self-assign-overloaded-warn-test.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -Wself-assign -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wself-assign -wtest -verify -DSILENCE %s + +struct S {}; + +void f() { + S a; +#ifndef SILENCE + a = a; // expected-warning{{explicitly assigning}} +#else + // expected-no-diagnostics + a = a; +#endif +} Index: tools/diagtool/DiagnosticNames.cpp =================================================================== --- tools/diagtool/DiagnosticNames.cpp +++ tools/diagtool/DiagnosticNames.cpp @@ -28,9 +28,9 @@ // FIXME: Is it worth having two tables, especially when this one can get // out of sync easily? static const DiagnosticRecord BuiltinDiagnosticsByID[] = { -#define DIAG(ENUM,CLASS,DEFAULT_MAPPING,DESC,GROUP, \ - SFINAE,NOWERROR,SHOWINSYSHEADER,CATEGORY) \ - { #ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t) }, +#define DIAG(ENUM, CLASS, DEFAULT_MAPPING, DESC, GROUP, SFINAE, NOWERROR, \ + SHOWINSYSHEADER, HIDEINTESTS, CATEGORY) \ + {#ENUM, diag::ENUM, STR_SIZE(#ENUM, uint8_t)}, #include "clang/Basic/DiagnosticCommonKinds.inc" #include "clang/Basic/DiagnosticCrossTUKinds.inc" #include "clang/Basic/DiagnosticDriverKinds.inc" Index: utils/TableGen/ClangDiagnosticsEmitter.cpp =================================================================== --- utils/TableGen/ClangDiagnosticsEmitter.cpp +++ utils/TableGen/ClangDiagnosticsEmitter.cpp @@ -552,6 +552,11 @@ else OS << ", false"; + if (R.getValueAsBit("HideInTests")) + OS << ", true"; + else + OS << ", false"; + // Category number. OS << ", " << CategoryIDs.getID(getDiagnosticCategory(&R, DGParentMap)); OS << ")\n";