I'm looking to create AST matchers for variables that are templated. For
example, in the code:

template <class T> class Class  // template <(class or typename or
int/float/etc) T>
{
public:

void Func(T* Param)            // 1) match Param
{
   Param = nullptr;                 // 2) match Param
}

T* Var = nullptr;                    // 3) match Var
};

int main()
{
   Class<float> MyClass;
   float FloatVal;
   MyClass.Var = &FloatVal;  // 4) match Var
}

Ideally, I'd like one matcher to find each of the 4 matches, but I suspect
I need individual matchers for each of them.  For the first match above I
have varDecl(hasType(templateTypeParmType())), but I haven't had luck with
clang-query in finding the other 3. Any help would be much appreciated!

Thanks,
Robert
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to