[cfe-dev] AST Matcher for Type Traits

David Lai via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 19 15:21:21 PDT 2018


Hi,

I am trying to write a matcher to change

template <typename T>
typename std::enable_if<std::is_reference<T>::value, bool>::type is_ref() { return true; }

to

template <typename T>
std::enable_if_t<std::is_reference<T>::value, bool> is_ref() { return true; }

I have been struggling to write a match for the “typename std::enable_if…” line.
I am able to match the template <…> line using “typeAliasTemplateDecl” and perhaps just retrieve the next line and check if it has “typename …”.
I was wondering if you could give me pointers to write a better matcher?


Thanks,
David Lai



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180419/33c6590d/attachment.html>


More information about the cfe-dev mailing list