================
@@ -10,21 +10,44 @@
 
 namespace clang::lifetimes::internal {
 
-void PathLoan::dump(llvm::raw_ostream &OS) const {
-  OS << getID() << " (Path: ";
-  if (const clang::ValueDecl *VD = Path.getAsValueDecl())
+void AccessPath::dump(llvm::raw_ostream &OS) const {
+  if (const clang::ValueDecl *VD = getAsValueDecl())
     OS << VD->getNameAsString();
   else if (const clang::MaterializeTemporaryExpr *MTE =
-               Path.getAsMaterializeTemporaryExpr())
-    // No nice "name" for the temporary, so deferring to LLVM default
+               getAsMaterializeTemporaryExpr())
     OS << "MaterializeTemporaryExpr at " << MTE;
-  else
-    llvm_unreachable("access path is not one of any supported types");
+  else if (const PlaceholderRoot *PB = getAsPlaceholderRoot()) {
+    if (const auto *PVD = PB->getParmVarDecl())
+      OS << "$" << PVD->getNameAsString();
+    else if (PB->getMethodDecl())
+      OS << "$this";
+  } else
+    llvm_unreachable("access path base invalid");
+}
+
+void Loan::dump(llvm::raw_ostream &OS) const {
+  OS << getID() << " (Path: ";
+  Path.dump(OS);
   OS << ")";
 }
 
-void PlaceholderLoan::dump(llvm::raw_ostream &OS) const {
-  OS << getID() << " (Placeholder loan)";
+const PlaceholderRoot *
+LoanManager::getOrCreatePlaceholderRoot(const ParmVarDecl *PVD) {
----------------
Xazax-hun wrote:

I am wondering if we actually want to heap allocate `PlaceholderRoot`? It is a 
single pointer union inside, shouldn't we just give back the values?

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

Reply via email to