Default case without predecessor

Hi,

If I run clang on the code below, either via my own FrontendAction and
libtooling or just with
clang -cc1 -analyze -analyze-checker debug.DumpCFG I get an CFG where the
default case
has no predecessor. If I compile the code to llvm and dump a CFG from opt
then all cases
are successors of the switch.

Is it possible to obtain a CFG from clang with all edges for the switch
statement?

cheers,
Panke

I believe the edge from the switch to the default case is pruned because all of the enum values are covered by the switch. The analyzer is considering the default case as “not possible”.

Zach

Zach Davis wrote

I believe the edge from the switch to the default case is pruned because
all of the enum values are covered by the switch. The analyzer is
considering the default case as "not possible".

Is it possible to get a CFG before pruning? I've tried
BuildOptions.PruneTrivialFalseEdges = false, but that didn't help.

It looks like the option to disable this is

CFGBlock::FilterOptions.IgnoreDefaultsWithCoveredEnums

I don’t know what the easiest way to get this unset in you
program would be.