================
@@ -709,6 +770,32 @@ static Error serializeIndex(const ClangDocContext &CDCtx, 
StringRef RootDir) {
   return Error::success();
 }
 
+static void serializeContexts(Info *I,
+                              StringMap<std::unique_ptr<Info>> &Infos) {
+  if (I->USR == GlobalNamespaceID)
+    return;
+  auto ParentUSR = I->ParentUSR;
+
+  while (true) {
+    Info *ParentInfo =
+        Infos.at(llvm::toStringRef(llvm::toHex(ParentUSR)).str()).get();
----------------
ilovepi wrote:

I'm a little confused by this. you're using `toStringRef()` on an 
`std::string`, and then calling `.str()` to go back to an `std::string`, but 
the interface is `StringRef` AFAICT ... am I missing something obvious?

Also, maybe we should just use `auto&` to have a reference to the unique_ptr, 
instead of getting the raw pointer inside? Not the biggest deal, but we won't 
leak the ptr that way by accident

https://github.com/llvm/llvm-project/pull/173297
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to