[cfe-dev] CFG doesn't call implicit destructor on exception edge?
Delesley Hutchins
delesley at google.com
Thu Mar 1 11:57:16 PST 2012
What's the current status of throw expressions in the clang CFG? They
seem to be supported, but a throw does not perform calls to implicit
destructors before hitting the exit block. For example, the CFG for
the code below does not include a call to ~MutexLock after the throw.
-DeLesley
(*) Code:
void Foo::test() {
MutexLock lock(&mutex_);
if (condition()) {
throw 0;
}
}
(*) CFG:
[B4 (ENTRY)]
Succs (1): B3
[B1]
1: [B3.5].~MutexLock() (Implicit destructor)
Preds (1): B3
Succs (1): B0
[B2]
1: 0
2: throw [B2.1]
Preds (1): B3
Succs (1): B0
[B3]
1: this
2: [B3.1]->mutex_
3: &[B3.2]
4: [B3.3] (CXXConstructExpr, class MutexLock)
5: MutexLock lock(&this->mutex_);
6: condition
7: [B3.6] (ImplicitCastExpr, FunctionToPointerDecay, _Bool (*)(void))
8: [B3.7]()
T: if [B3.8]
Preds (1): B4
Succs (2): B2 B1
[B0 (EXIT)]
Preds (2): B1 B2
--
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315
More information about the cfe-dev
mailing list