implement a method which returns the most const type of a declaration. this method could have a type declaration like this:
clang::QualType (*f)(clang::QualType declaration, std::set<clang::QualType> usages);
here is the related Clang documentation on types.