@@ -298,20 +298,41 @@ TEST_F(ConfigCompileTests, DiagnosticSuppression) {
298
298
" unreachable-code" , " unused-variable" ,
299
299
" typecheck_bool_condition" ,
300
300
" unexpected_friend" , " warn_alloca" ));
301
- EXPECT_TRUE (isBuiltinDiagnosticSuppressed (
302
- diag::warn_unreachable, Conf.Diagnostics .Suppress , LangOptions ()));
301
+ clang::DiagnosticsEngine DiagEngine (nullptr , nullptr ,
302
+ new clang::IgnoringDiagConsumer);
303
+
304
+ using Diag = clang::Diagnostic;
305
+ {
306
+ auto D = DiagEngine.Report (diag::warn_unreachable);
307
+ EXPECT_TRUE (isDiagnosticSuppressed (
308
+ Diag{&DiagEngine}, Conf.Diagnostics .Suppress , LangOptions ()));
309
+ }
303
310
// Subcategory not respected/suppressed.
304
- EXPECT_FALSE (isBuiltinDiagnosticSuppressed (
305
- diag::warn_unreachable_break, Conf.Diagnostics .Suppress , LangOptions ()));
306
- EXPECT_TRUE (isBuiltinDiagnosticSuppressed (
307
- diag::warn_unused_variable, Conf.Diagnostics .Suppress , LangOptions ()));
308
- EXPECT_TRUE (isBuiltinDiagnosticSuppressed (diag::err_typecheck_bool_condition,
309
- Conf.Diagnostics .Suppress ,
310
- LangOptions ()));
311
- EXPECT_TRUE (isBuiltinDiagnosticSuppressed (
312
- diag::err_unexpected_friend, Conf.Diagnostics .Suppress , LangOptions ()));
313
- EXPECT_TRUE (isBuiltinDiagnosticSuppressed (
314
- diag::warn_alloca, Conf.Diagnostics .Suppress , LangOptions ()));
311
+ {
312
+ auto D = DiagEngine.Report (diag::warn_unreachable_break);
313
+ EXPECT_FALSE (isDiagnosticSuppressed (
314
+ Diag{&DiagEngine}, Conf.Diagnostics .Suppress , LangOptions ()));
315
+ }
316
+ {
317
+ auto D = DiagEngine.Report (diag::warn_unused_variable);
318
+ EXPECT_TRUE (isDiagnosticSuppressed (
319
+ Diag{&DiagEngine}, Conf.Diagnostics .Suppress , LangOptions ()));
320
+ }
321
+ {
322
+ auto D = DiagEngine.Report (diag::err_typecheck_bool_condition);
323
+ EXPECT_TRUE (isDiagnosticSuppressed (
324
+ Diag{&DiagEngine}, Conf.Diagnostics .Suppress , LangOptions ()));
325
+ }
326
+ {
327
+ auto D = DiagEngine.Report (diag::err_unexpected_friend);
328
+ EXPECT_TRUE (isDiagnosticSuppressed (
329
+ Diag{&DiagEngine}, Conf.Diagnostics .Suppress , LangOptions ()));
330
+ }
331
+ {
332
+ auto D = DiagEngine.Report (diag::warn_alloca);
333
+ EXPECT_TRUE (isDiagnosticSuppressed (
334
+ Diag{&DiagEngine}, Conf.Diagnostics .Suppress , LangOptions ()));
335
+ }
315
336
316
337
Frag.Diagnostics .Suppress .emplace_back (" *" );
317
338
EXPECT_TRUE (compileAndApply ());
0 commit comments