[cfe-dev] Question about 'CodeGenFunction::EmitGotoStmt'

jingu kang via cfe-dev cfe-dev at lists.llvm.org
Tue Jun 29 10:26:58 PDT 2021


Hi All,

>From a spec benchmark, I have seen that the ‘goto’ statement goes to
its destination through the cleanup function as below.

void CodeGenFunction::EmitGotoStmt(const GotoStmt &S) {
  // If this code is reachable then emit a stop point (if generating
  // debug info). We have to do this ourselves because we are on the
  // "simple" statement path.
  if (HaveInsertPoint())
    EmitStopPoint(&S);
  EmitBranchThroughCleanup(getJumpDestForLabel(S.getLabel()));
}

I guess we could emit the branch for the target directly. If possible,
can someone let me know why the goto statement has to go through the
cleanup function please? If I missed something, please let me know.

Additionally, I would like to subscribe to cfe-dev with the email
address jingu.kang at arm.com. I have sent the email to
subscribe at llvm.org. If possible, can someone check it please?

Thanks
JinGu Kang


More information about the cfe-dev mailing list