SemaSourceWithPriorities is a special SemaSource that wraps our normal LLDB ExternalASTSource and
the ASTReader (which is used for the C++ module loading). It's only active when the import-std-module
setting is turned on.
The CompleteType function there in SemaSourceWithPriorities is looping over all ExternalASTSources and
asks each to complete the type. However, that loop is in another loop that keeps doing that until the type is
complete. If that function is ever called on a type that is a forward decl then that causes LLDB to go into an
infinite loop.
I remember I added that second loop and the comment because I thought I saw a similar pattern in some other Clang
code, but after some grepping I can't find that code anywhere and it seems the rest of the code base only calls
CompleteType once (It would also be kinda silly to have calling it multiple times). So it seems that's just a silly mistake.
The is implicitly tested by importing std::pair, but I also added a simpler dedicated test that creates a dummy
libc++ module with some forward declarations and then imports them into the scratch AST context. At some point
the ASTImporter will check if one of the forward decls could be completed by the ExternalASTSource, which will cause the
SemaSourceWithPriorities to go into an infinite loop once it receives the CompleteType call.