[PATCH] D135191: [Index] USRGeneration doesn't depend on unnamed.printName() => ''. NFC

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 5 06:51:33 PDT 2022


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG20c9ac292504: [Index] USRGeneration doesn't depend on unnamed.printName() => ''. NFC (authored by sammccall).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135191/new/

https://reviews.llvm.org/D135191

Files:
  clang/lib/Index/USRGeneration.cpp


Index: clang/lib/Index/USRGeneration.cpp
===================================================================
--- clang/lib/Index/USRGeneration.cpp
+++ clang/lib/Index/USRGeneration.cpp
@@ -179,10 +179,11 @@
 //===----------------------------------------------------------------------===//
 
 bool USRGenerator::EmitDeclName(const NamedDecl *D) {
-  const unsigned startSize = Buf.size();
-  D->printName(Out);
-  const unsigned endSize = Buf.size();
-  return startSize == endSize;
+  DeclarationName N = D->getDeclName();
+  if (N.isEmpty())
+    return true;
+  Out << N;
+  return false;
 }
 
 bool USRGenerator::ShouldGenerateLocation(const NamedDecl *D) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135191.465380.patch
Type: text/x-patch
Size: 661 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221005/58591414/attachment-0001.bin>


More information about the cfe-commits mailing list