Accessing preprocessed text

Hi

I’m writing a clang tool and one of the things I have to do is to dump all of the attributes of functions. So for example, If I specify an attribute attribute((myAttribute(“arg1”))), I’d like to output myAttribute(“arg1”)
There is the printPretty function of clang::Attr, but this also appends the attribute (which I could chip away, but that’s not a nice solution). So what I tried is to go via the source, but here I stumble over the usage of macros/preprocessor. What I tried is this:

clang::SourceRange range = attr->getRange();
clang::SourceRange expandedRange(sm.getExpansionLoc(range.getBegin()), sm.getExpansionLoc(range.getEnd()));
assert(expandedRange.isValid());
std::string text = clang::Lexer::getSourceText(clang::CharSourceRange::getTokenRange(expandedRange), sm, clang::LangOptions(), 0);
But if the attribute is specified by means of a preprocessor macro, I get the name of the macro and not the expanded text. 
What is the best way of getting the macro text? 
Thank you