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