<div dir="ltr">It seems that AST data in different translation units seems not sharing, for example:<div><br></div><div>A.h:</div><div>struct A {}</div><div><br></div><div>B.cpp:</div><div>struct B : public A {}</div><div><br></div><div>C.cpp:</div><div>struct C : public A {}</div><div><br></div><div>Let's say I have a tool using ast matcher, I passed both B.cpp and C.cpp to my tool, and I found that neither the pointer to clang::CXXRecordDecl of A or the pointer to clang::Type of A are the same. (That's saying, the pointer of A's type when parsing B.cpp is not the same as parsing C.cpp), and so does the ASTContext, two different translation units have totally different ASTContext instances.</div><div><br></div><div>So I got a few questions:</div><div>1. Any way I can make different translation units share the same ASTContext instance?<br></div><div>2. If not, how can I compare if two declarations have the same type? Currently my solution is to save the full name (with namespace), but this is not very effective (get namespace from a declaration needs recursive searching for parents)</div></div>