[cfe-dev] ifStmt::getThen() returns ifStmt again?

Ulrich Thomas Gabor via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 27 12:10:40 PDT 2019


Hi

I recently started to test the current master
https://github.com/llvm/llvm-project/commit/e04483ee35ba28c089cbbcec97a96b67ce0a035e

and found that ifStmt::getThen() now returns the ifStmt itself like in the
following code where both dump calls give the same output:

 stmt.dump(dbgs());
 const IfStmt ifS = cast<IfStmt>(stmt);
 auto x = ifS.getThen();
 x->dump(dbgs());

The AST was generated for a simple program:

int main(int argc, char ** argv) {
	int a = 0;
	if (true) {
		a = 10;
	}
	return a;
}


This was not the case for LLVM 8, previously the a=10 stmt was returned.
Should it be that way or am I doing something wrong?

Best
Ulrich




More information about the cfe-dev mailing list