Example #1
0
//--------------------------------------------------------- 
void removeGotosToNextLabel(StmtEditor& editor, Stmt* Node)
{
  RemoveGotosToNextLabel visitor(editor);
  visit_df(Node, visitor);
  for (RemoveGotosToNextLabel::tTouchedLabels::iterator i = visitor.m_TouchedLabels.begin(), 
       e = visitor.m_TouchedLabels.end(); i != e; ++i)
  {
    if (!i->second.m_Used)
    {
      LabelStmt* LS = i->second.LS;
      assert(LS);
      CompoundStmt* CS = dyn_cast<CompoundStmt>(editor.getParent(LS));
      if (CS && CS->size() > 1 && isa<NullStmt>(LS->getSubStmt()))
      {
        editor.removeStmt(CS, LS);
      }
      else
      {
        editor.replaceStatement(LS, LS->getSubStmt());
      }
    }
  }
}
Example #2
0
 virtual SourceRange getRange(const LabelStmt &Node) {
   return Node.getDecl()->getSourceRange();
 }
Example #3
0
void CodeGenFunction::EmitLabelStmt(const LabelStmt &S) {
  EmitLabel(S);
  EmitStmt(S.getSubStmt());
}