[cfe-dev] Inconsistency with extracting template type strings

Benjamin Schindler schindler at virtamed.com
Fri Sep 5 09:06:04 PDT 2014


Hi

Consider the following C++ code:

template<typename T, typename U = int >
class Test { };
template class Test<float>;
// Test<float> v;

And my visitor for the ClassTemplateSpecializationDecl does the following:

clang::LangOptions langOpts;
langOpts.CPlusPlus = true;
clang::PrintingPolicy policy(langOpts);clang::QualType qualifiedType =
astcontex.getRecordType(decl);std::string name =
qualifiedType.getAsString(policy);

With the code above, I get:

Test<float>

Now, comment line 3 and uncomment line 4, and you get:

Test<float, int>

First, is this intentional? Second, for the clang tool I'm writing, I
need the second version (full specification) always. Is there a way to
achieve this?

Thank you

Benjamin Schindler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140905/d93c4ee3/attachment.html>


More information about the cfe-dev mailing list