[cfe-dev] Function body type
Sebastian Redl
sebastian.redl at getdesigned.at
Sun Apr 26 08:19:29 PDT 2009
Hi,
Small problem: the type of a function's body is currently CompoundStmt.
However, in C++ we have function-try-blocks:
void f() try {
// things that could throw
} catch(something) {
// ...
} catch(...) {
// ...
}
The obvious solution here is to change FunctionDecl so that its body can
be either a CompoundStmt or a CXXTryStmt (by having getBody() return
either a Stmt* or a PointerVariant). However, this change is quite
disrupting to many, many components.
The alternative is to represent such functions as if they were written as
void f() {
try { .... } ...
}
There exists a difference in semantics for constructors and destructors
only (where a function-try-block covers base and member
initializers/destructors, whereas a try-block does not), which could be
stored in a flag in those functions. But I don't like this workaround.
Thoughts?
Sebastian
More information about the cfe-dev
mailing list