Conflict replacement when find variable based on type

Hi, I have problem to solve conflict replacement for my custom clang-tidy check. In my check, I want to find all double types and replace them with custom variable Real. If they are inside MyName namespace scope than they will be replaced to Real. Otherwise they will be replaced to MyName::Real. The problem occurs when double type variable is declared in constructor with initialization. When the constructor is called outside MyName scope, the double type will be replaced with MyName::Real whereas it should be replaced with Real before by previous finding. Thus conflict replacement happens. Below is the example code.


namespace MyName {

typedef double Real;

template <class T> 
class vector { 
	T temp_val;

class CustomClass {
	CustomClass(vector<double> foo,
				const vector<double>& bar = vector<double>()  // here double will replace with Real)



#include "trial.hpp"

void func3()
    MyName::vector<double> v;
    MyName::CustomClass customClass(v); // here vector<double>() will called and double will be replace with MyName::Real because clang will consider this outside MyName scope

This is how I use AST Mathcer to find double type

m typeLoc(

m typeLoc(

Please help me to solve this problem. Thanks.