Author: Sam McCall
Date: 2022-10-05T15:51:00+02:00
New Revision: 20c9ac29250493f5e0a3791dc1e5e9114ff0dc6e

URL: 
https://github.com/llvm/llvm-project/commit/20c9ac29250493f5e0a3791dc1e5e9114ff0dc6e
DIFF: 
https://github.com/llvm/llvm-project/commit/20c9ac29250493f5e0a3791dc1e5e9114ff0dc6e.diff

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

This prepares for printName() to print `(anonymous struct)` etc in D134813.

Differential Revision: https://reviews.llvm.org/D135191

Added: 
    

Modified: 
    clang/lib/Index/USRGeneration.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Index/USRGeneration.cpp 
b/clang/lib/Index/USRGeneration.cpp
index c1120058235c6..e804abe2de50f 100644
--- a/clang/lib/Index/USRGeneration.cpp
+++ b/clang/lib/Index/USRGeneration.cpp
@@ -179,10 +179,11 @@ class USRGenerator : public 
ConstDeclVisitor<USRGenerator> {
 
//===----------------------------------------------------------------------===//
 
 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) {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to