Hi, <div><br></div><div> While LiveVariables analysis (tools/clang/lib/Analysis/LiveVariables.cpp) does not generate any output? Specifically, for this simple program:</div><div><div> 1 int main(int argc, char *argv[])</div>
<div> 2 {</div><div> 3 int a,b,c,d,x;</div><div> 4 </div><div> 5 a = 3; //Basic block B1</div><div> 6 b = 5;</div><div> 7 d = 4;</div><div> 8 x = 100;</div><div> 9 </div><div> 10 if(a>b){ //Basic block B2</div>
<div> 11 c = a+b;</div><div> 12 d = 2;</div><div> 13 }</div><div> 14 </div><div> 15 c = 4; //Basic block B3</div><div> 16 return b * d + c;</div><div> 17 }</div></div><div>This simple example is taken from this wiki page illustrating live variables analysis (<a href="http://en.wikipedia.org/wiki/Live_variable_analysis">http://en.wikipedia.org/wiki/Live_variable_analysis</a>).</div>
<div>Both B2 and B3 should have live variables, but the output (using LiveVariables::dumpBlockLiveness(SourceManager &)) says no live variables exist. I am trying to use this analysis as an example on how to write a good analysis algorithm for Clang, but really did not expect this behavior for this analysis.</div>
<div>Anybody who knows the answer please let me know. Many thanks!!!</div><div><br></div><div>--------</div><div>Guoping</div>