how to retrieve scope information of identifiers using ASTConsumer and Visitor classes?

Hi,
I want identifier scope information for function body and loop body
can i get it while i am traversing AST with ASTConsumer and Visitors?
If yes then how to do this

Thanks in advance,