[cfe-dev] Getting SubstTemplateTypeParmType Template Info

fdart via cfe-dev cfe-dev at lists.llvm.org
Thu Jul 4 15:11:16 PDT 2019


Given the below input to clang tooling, when I traverse ParameterMap's
type, I get that std::map is a template specialization, with two nested
template specializations, std::basic_string.  Therefore I can extract the
information I'm looking for.
#include <map>

using String = std::string;
using ParameterMap = std::map<String, String>;

If we take the indirection one step further with this input to clang tooling
#include <map>

template <typename K, typename V> using Map = std::map<K, V>;
using String = std::string;
using ParameterMap = Map<String, String>;

ParameterMap someFunc() { return ParameterMap(); }

then String is now a SubstTemplateTypeParmType.  If I desugar that, I get
that String is a record rather than a template specialization, so I cannot
get the template types of String.  Is that intended?  How can I get the
template information for String in this case?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190704/8f807655/attachment.html>

More information about the cfe-dev mailing list