[cfe-dev] clang and gcc implement __PRETTY_FUNCTION__ differently

Nikola Smiljanic popizdeh at gmail.com
Mon Mar 19 09:21:26 PDT 2012


> As John noted, if you want to get back to the original source, you'll need to make this a loop. Plus, you'll probably > want to check if it was an explicit specialization and stop iterating at that point, since explicit specializations were > written by the user (rather than instantiated).

After some poking around I realized that I've seen code like this
somewhere. This is exactly what  getTemplateInstantiationPattern does,
it even handles the explicit specialization case that I wasn't aware
of. But I still can't think of the test case where repeated calls to
getInstantiatedFromMemberTemplate are needed, please help.

> There are a few cases here, too. For example, you could have a CXXRecordDecl that's an instantiation of a member class, e.g.,
>
> template<typename T>
> struct X {
>        struct Inner {
>                void f();
>        };
> };
>
> and you don't want to skip "Inner" in the printing.

I think that you're wrong on this one, this loop is used only to
collect classes that have template parameters. This is how I print the
template parameter names inside the square brackets.
getQualifiedNameAsString prints the class names, I haven't touched
that part so nothing gets skipped.




More information about the cfe-dev mailing list