This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Initialize ShouldEmitErrorsOnInvalidConfigValue analyzer option
ClosedPublic

Authored by steakhal on Sep 14 2022, 5:00 AM.

Details

Summary

Downstream users who don't make use of the clang cc1 frontend for
commandline argument parsing, won't benefit from the Marshalling
provided default initialization of the AnalyzerOptions entries. More
about this later.
Those analyzer option fields, as they are bitfields, cannot be default
initialized at the declaration (prior c++20), hence they are initialized
at the constructor.
The only problem is that ShouldEmitErrorsOnInvalidConfigValue was
forgotten.

In this patch, I'm proposing to initialize that field with the rest.

Note that this value is read by
CheckerRegistry.cpp:insertAndValidate().
The analyzer options are initialized by the marshalling at
CompilerInvocation.cpp:GenerateAnalyzerArgs() by the expansion of the
ANALYZER_OPTION_WITH_MARSHALLING xmacro to the appropriate default
value regardless of the constructor initialized list which I'm touching.
Due to that this only affects users using CSA as a library, without
serious effort, I believe we cannot test this.

Diff Detail

Event Timeline

steakhal created this revision.Sep 14 2022, 5:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2022, 5:00 AM
steakhal requested review of this revision.Sep 14 2022, 5:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 14 2022, 5:00 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
martong accepted this revision.Sep 14 2022, 6:53 AM

Okay, I don't see any problem with this change. LGTM.

This revision is now accepted and ready to land.Sep 14 2022, 6:53 AM