[clang] [clang][ExtractAPI] Add ability to create multiple symbol graphs (PR #86676)

Daniel Grumberg via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 09:58:44 PDT 2024


================
@@ -50,17 +51,20 @@ TypedefUnderlyingTypeResolver::getSymbolReferenceForType(QualType Type,
   SmallString<128> TypeUSR;
   const NamedDecl *TypeDecl = getUnderlyingTypeDecl(Type);
   const TypedefType *TypedefTy = Type->getAs<TypedefType>();
+  StringRef OwningModuleName;
 
   if (TypeDecl) {
     if (!TypedefTy)
       TypeName = TypeDecl->getName().str();
 
     clang::index::generateUSRForDecl(TypeDecl, TypeUSR);
+    if (auto *OwningModule = TypeDecl->getImportedOwningModule())
+      OwningModuleName = API.copyString(OwningModule->Name);
   } else {
     clang::index::generateUSRForType(Type, Context, TypeUSR);
   }
 
-  return {API.copyString(TypeName), API.copyString(TypeUSR)};
+  return {API.copyString(TypeName), API.copyString(TypeUSR), OwningModuleName};
----------------
daniel-grumberg wrote:

TODO: Can this be expressed as APISet.createSymbolReference

https://github.com/llvm/llvm-project/pull/86676


More information about the cfe-commits mailing list