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.

trial.hpp

namespace MyName {

typedef double Real;

template <class T> 
class vector { 
	T temp_val;
};

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

}

trial.cpp

#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(
    loc(asString("double")),
    unless(hasAncestor(namespaceDecl(hasName("MyName")))),
    unless(hasParent(typedefDecl(hasName("Real"))))
).bind("double_out_namespace_type")

m typeLoc(
    loc(asString("double")),
    hasAncestor(namespaceDecl(hasName("MyName"))),
    unless(hasParent(typedefDecl(hasName("Real"))))
).bind("double_in_namespace_type")

Please help me to solve this problem. Thanks.