I'm trying to understand Clang's CFG by looking at its dumped output and it's unclear to me how try/catch statements are represented in the CFG.
Consider this little snippet:
int func(int x);
int func2(int x) {
try {
return func(x);
} catch(...) {
return 0;
}
}
The dumped CFG is the following:
$ clang++ -Xclang -analyze -Xclang -analyzer-checker=debug.DumpCFG -fsyntax-only test.cpp
int func2(int x)
[B4 (ENTRY)]
Succs (1): B3
[B1]
T: try ...
Succs (1): B2
[B2]
catch (...):
1: catch (...) {
[B2.3]}
2: 0
3: return [B2.2];
Preds (1): B1
Succs (1): B0
[B3]
1: func
2: [B3.1] (ImplicitCastExpr, FunctionToPointerDecay, int (*)(int))
3: x
4: [B3.3] (ImplicitCastExpr, LValueToRValue, int)
5: [B3.2]([B3.4])
6: return [B3.5];
Preds (1): B4
Succs (1): B0
[B0 (EXIT)]
Preds (2): B2 B3
I do not understand how the B1 basic block is linked to the others. The entry block seemingly jumps directly to B3 which contains the body of the try{} statement. Then, B3 has the exit block as its only successor. So B1 and B2 seems to be unlinked from the main flow of the function.
How do I have to interpret the CFG in this case?