I am very new to clang. So please excuse me if this question sounds very silly.
I am trying to write a simple Clang checker.
I have a simple program.
void function(int a)
{
   printf("%d", a);
}
main()
{      
       static int A = 0; 
       //some computation
       //How to get the source of the variable declaration of A here? 
       func(A);    
}
My Attempt
void MyChecker::checkPreCall(const CallEvent &Call,
                                       CheckerContext &C) const {
   ParamVarDecl *VD = Call.parameters()[0];
   //this dumps the declaration of the callee function, i.e dest
   Call.parameters()[0]->dump();
   if(Call.parameters()[0]->isStaticLocal()){
        std::cout << "Static variable";
    }
}
I am trying to get the Variable Declaration of the of A at the time of calling func. However it gets the variable declaration of the callee argument; i.e the dest. How do I get the variable declaration of the source?
 
     
    