Checking whether a particular using namespace statement qualifies something.

Hello!
What is the best way to check whether a particular 'using namespace'
statement qualifies something or not?
So far I've tried to get the canonical type from a QualType of a
declaration, but it fails on this example:

namespace X {
  struct klassX {};
}
namespace A {
  typedef X::klassX klassA;
}
using namespace A;
int main() {
  klassA* p = 0;
  return 0;
}

Here canonical type for p is 'struct X::klassX'. So, is there a way to
directly get the using namespace statements responsible for a declaration or
a function call.
Thank you!