CXXMethodDecl body is empty !

Hi,

my cpp class

class Rectangle{

public :
              void add(int a,int b){
                            retrun a+b;
                    }

}
i'm trying to get my c++ method body, by calling CXXMethodDecl->getBody()
but i get no body , is it the right method to call

Thank you

Presumably, this is not the exact copy of the code you have tested.
Because your example is ill-formed; there is a typo in `return`
keyword, function return type is `void`, but it's trying to return an
`int`. Finally, there is no semi after class body. Clang won't create
an AST for ill-formed code.

Whether you can get the body depends on when you call `getBody`. For
that to work, it must first parse the body. I would suggest you to
start working with AST when it's fully parsed, as this will cause less
confusion; do the work inside your implementation of
ASTConsumer::HandleTranslationUnitDecl, where you will have
translation unit completely parsed for a well-formed code.

Ismail