[llvm-dev] Scope differentiate.
Umesh Kalappa via llvm-dev
llvm-dev at lists.llvm.org
Fri May 26 09:54:43 PDT 2017
Hi All ,
We added the below code to differentiate Local and Global Variable in
the "NamedDecl *Sema::HandleDeclarator" function.
if(S->getFlags() == Scope::DeclScope)
its global
else
its local
Where S is a pointer parameter to the HandleDeclarator of type Scope.
At first place ,we decided to use
"D.getDeclSpec().getStorageClassSpec()" ,but has no luck ,since its
always "SCS_unspecified " .
Question is that , do using the "Scope::DeclScope" to differentiate
the variable scope is the right approach, if so
we have a problem for some instance like a nested local declaration,
we are not able to differentiate.
if the "Scope::DeclScope" is not the right approach, then please
anybody here , help us with the right approach and would like to
inform you all that, we need this info before any Act call like
"ActOnVariableDeclarator"
Thank you
~Umesh
More information about the llvm-dev
mailing list