ASTContext::getObjCInterfaceType always tries to find the definition of the ObjCInterfaceDecl which
we try to create a type for. This code doesn't seem to serve any purpose from what I can see.
I checked all Clang tests and compiled all LLDB Foundation tests with -fmodules and I couldn't find a
single call where this code has any effect (beside spending a bit of time looking for a definition). We
always either don't have a definition at all or the current Decl is already the definition so nothing changes.
The code also can't save us any time as the way we retrieve the Decl later is by first unconditionally
throwing away the definition via getCanonicalDecl() and then we try to find the definition again:
ObjCInterfaceDecl *ObjCInterfaceType::getDecl() const { ObjCInterfaceDecl *Canon = Decl->getCanonicalDecl(); if (ObjCInterfaceDecl *Def = Canon->getDefinition()) return Def; return Canon; }
From the git log it seems like this was some (pre-modules) attempt to make sure we always point to
the definition from an ObjCInterfaceType. That code was since updated to work with modules in
D110452 (which added the new version of getDecl that correctly updates the redeclarations
to find a definition from a module).