[cfe-dev] scopes in CFGs

Evan Herbst eherbst at cs.washington.edu
Mon Mar 15 10:06:27 PDT 2010


When I call buildCFG() with AddScopes = true, I get an end-scope node with no predecessors. EG

int main()
{
	return 0;
}

gives

<<<
  [ B3 (ENTRY) ]
     Predecessors (0):
     Successors (1): B2

  [ B1 ]
       1: end scope
     Predecessors (0):
     Successors (1): B0

  [ B2 ]
       1: start scope
       2: return 0;
     Predecessors (1): B3
     Successors (1): B0

  [ B0 (EXIT) ]
     Predecessors (2): B1 B2
     Successors (0):
 >>>

. I don't see any existing call of buildCFG() with AddScopes = true. Is this the intended behavior?

My code looks like

FunctionDecl* f = ...;
CFG* cfg = CFG::buildCFG(f, f->getBody(), &f->getASTContext(), false/* add exception handling edges */, true/* add 
scopes */);
cfg->dump(LangOptions());

Thanks.

- Evan



More information about the cfe-dev mailing list