1 //===- USRGeneration.cpp - Routines for USR generation --------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "clang/Index/USRGeneration.h"
11 #include "clang/AST/ASTContext.h"
12 #include "clang/AST/DeclTemplate.h"
13 #include "clang/AST/DeclVisitor.h"
14 #include "clang/Lex/PreprocessingRecord.h"
15 #include "llvm/ADT/SmallString.h"
16 #include "llvm/Support/Path.h"
17 #include "llvm/Support/raw_ostream.h"
19 using namespace clang;
20 using namespace clang::index;
22 //===----------------------------------------------------------------------===//
24 //===----------------------------------------------------------------------===//
26 /// \returns true on error.
27 static bool printLoc(llvm::raw_ostream &OS, SourceLocation Loc,
28 const SourceManager &SM, bool IncludeOffset) {
29 if (Loc.isInvalid()) {
32 Loc = SM.getExpansionLoc(Loc);
33 const std::pair<FileID, unsigned> &Decomposed = SM.getDecomposedLoc(Loc);
34 const FileEntry *FE = SM.getFileEntryForID(Decomposed.first);
36 OS << llvm::sys::path::filename(FE->getName());
38 // This case really isn't interesting.
42 // Use the offest into the FileID to represent the location. Using
43 // a line/column can cause us to look back at the original source file,
44 // which is expensive.
45 OS << '@' << Decomposed.second;
51 class USRGenerator : public ConstDeclVisitor<USRGenerator> {
52 SmallVectorImpl<char> &Buf;
53 llvm::raw_svector_ostream Out;
58 llvm::DenseMap<const Type *, unsigned> TypeSubstitutions;
61 explicit USRGenerator(ASTContext *Ctx, SmallVectorImpl<char> &Buf)
68 // Add the USR space prefix.
69 Out << getUSRSpacePrefix();
72 bool ignoreResults() const { return IgnoreResults; }
74 // Visitation methods from generating USRs from AST elements.
75 void VisitDeclContext(const DeclContext *D);
76 void VisitFieldDecl(const FieldDecl *D);
77 void VisitFunctionDecl(const FunctionDecl *D);
78 void VisitNamedDecl(const NamedDecl *D);
79 void VisitNamespaceDecl(const NamespaceDecl *D);
80 void VisitNamespaceAliasDecl(const NamespaceAliasDecl *D);
81 void VisitFunctionTemplateDecl(const FunctionTemplateDecl *D);
82 void VisitClassTemplateDecl(const ClassTemplateDecl *D);
83 void VisitObjCContainerDecl(const ObjCContainerDecl *CD);
84 void VisitObjCMethodDecl(const ObjCMethodDecl *MD);
85 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
86 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
87 void VisitTagDecl(const TagDecl *D);
88 void VisitTypedefDecl(const TypedefDecl *D);
89 void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
90 void VisitVarDecl(const VarDecl *D);
91 void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
92 void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
93 void VisitLinkageSpecDecl(const LinkageSpecDecl *D) {
96 void VisitUsingDirectiveDecl(const UsingDirectiveDecl *D) {
99 void VisitUsingDecl(const UsingDecl *D) {
100 IgnoreResults = true;
102 void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) {
103 IgnoreResults = true;
105 void VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) {
106 IgnoreResults = true;
109 bool ShouldGenerateLocation(const NamedDecl *D);
111 bool isLocal(const NamedDecl *D) {
112 return D->getParentFunctionOrMethod() != nullptr;
115 /// Generate the string component containing the location of the
117 bool GenLoc(const Decl *D, bool IncludeOffset);
119 /// String generation methods used both by the visitation methods
120 /// and from other clients that want to directly generate USRs. These
121 /// methods do not construct complete USRs (which incorporate the parents
122 /// of an AST element), but only the fragments concerning the AST element
125 /// Generate a USR for an Objective-C class.
126 void GenObjCClass(StringRef cls) {
127 generateUSRForObjCClass(cls, Out);
129 /// Generate a USR for an Objective-C class category.
130 void GenObjCCategory(StringRef cls, StringRef cat) {
131 generateUSRForObjCCategory(cls, cat, Out);
133 /// Generate a USR fragment for an Objective-C property.
134 void GenObjCProperty(StringRef prop) {
135 generateUSRForObjCProperty(prop, Out);
137 /// Generate a USR for an Objective-C protocol.
138 void GenObjCProtocol(StringRef prot) {
139 generateUSRForObjCProtocol(prot, Out);
142 void VisitType(QualType T);
143 void VisitTemplateParameterList(const TemplateParameterList *Params);
144 void VisitTemplateName(TemplateName Name);
145 void VisitTemplateArgument(const TemplateArgument &Arg);
147 /// Emit a Decl's name using NamedDecl::printName() and return true if
148 /// the decl had no name.
149 bool EmitDeclName(const NamedDecl *D);
152 } // end anonymous namespace
154 //===----------------------------------------------------------------------===//
155 // Generating USRs from ASTS.
156 //===----------------------------------------------------------------------===//
158 bool USRGenerator::EmitDeclName(const NamedDecl *D) {
160 const unsigned startSize = Buf.size();
163 const unsigned endSize = Buf.size();
164 return startSize == endSize;
167 bool USRGenerator::ShouldGenerateLocation(const NamedDecl *D) {
168 if (D->isExternallyVisible())
170 if (D->getParentFunctionOrMethod())
172 const SourceManager &SM = Context->getSourceManager();
173 return !SM.isInSystemHeader(D->getLocation());
176 void USRGenerator::VisitDeclContext(const DeclContext *DC) {
177 if (const NamedDecl *D = dyn_cast<NamedDecl>(DC))
181 void USRGenerator::VisitFieldDecl(const FieldDecl *D) {
182 // The USR for an ivar declared in a class extension is based on the
183 // ObjCInterfaceDecl, not the ObjCCategoryDecl.
184 if (const ObjCInterfaceDecl *ID = Context->getObjContainingInterface(D))
187 VisitDeclContext(D->getDeclContext());
188 Out << (isa<ObjCIvarDecl>(D) ? "@" : "@FI@");
189 if (EmitDeclName(D)) {
190 // Bit fields can be anonymous.
191 IgnoreResults = true;
196 void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) {
197 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
200 VisitDeclContext(D->getDeclContext());
201 if (FunctionTemplateDecl *FunTmpl = D->getDescribedFunctionTemplate()) {
203 VisitTemplateParameterList(FunTmpl->getTemplateParameters());
208 ASTContext &Ctx = *Context;
209 if (!Ctx.getLangOpts().CPlusPlus || D->isExternC())
212 if (const TemplateArgumentList *
213 SpecArgs = D->getTemplateSpecializationArgs()) {
215 for (unsigned I = 0, N = SpecArgs->size(); I != N; ++I) {
217 VisitTemplateArgument(SpecArgs->get(I));
222 // Mangle in type information for the arguments.
223 for (auto PD : D->params()) {
225 VisitType(PD->getType());
230 if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
233 if (unsigned quals = MD->getTypeQualifiers())
234 Out << (char)('0' + quals);
238 void USRGenerator::VisitNamedDecl(const NamedDecl *D) {
239 VisitDeclContext(D->getDeclContext());
242 if (EmitDeclName(D)) {
243 // The string can be empty if the declaration has no name; e.g., it is
244 // the ParmDecl with no name for declaration of a function pointer type,
245 // e.g.: void (*f)(void *);
246 // In this case, don't generate a USR.
247 IgnoreResults = true;
251 void USRGenerator::VisitVarDecl(const VarDecl *D) {
252 // VarDecls can be declared 'extern' within a function or method body,
253 // but their enclosing DeclContext is the function, not the TU. We need
254 // to check the storage class to correctly generate the USR.
255 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
258 VisitDeclContext(D->getDeclContext());
260 // Variables always have simple names.
261 StringRef s = D->getName();
263 // The string can be empty if the declaration has no name; e.g., it is
264 // the ParmDecl with no name for declaration of a function pointer type, e.g.:
265 // void (*f)(void *);
266 // In this case, don't generate a USR.
268 IgnoreResults = true;
273 void USRGenerator::VisitNonTypeTemplateParmDecl(
274 const NonTypeTemplateParmDecl *D) {
275 GenLoc(D, /*IncludeOffset=*/true);
279 void USRGenerator::VisitTemplateTemplateParmDecl(
280 const TemplateTemplateParmDecl *D) {
281 GenLoc(D, /*IncludeOffset=*/true);
285 void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) {
286 if (D->isAnonymousNamespace()) {
291 VisitDeclContext(D->getDeclContext());
293 Out << "@N@" << D->getName();
296 void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) {
297 VisitFunctionDecl(D->getTemplatedDecl());
300 void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) {
301 VisitTagDecl(D->getTemplatedDecl());
304 void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) {
305 VisitDeclContext(D->getDeclContext());
307 Out << "@NA@" << D->getName();
310 void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) {
311 const DeclContext *container = D->getDeclContext();
312 if (const ObjCProtocolDecl *pd = dyn_cast<ObjCProtocolDecl>(container)) {
316 // The USR for a method declared in a class extension or category is based on
317 // the ObjCInterfaceDecl, not the ObjCCategoryDecl.
318 const ObjCInterfaceDecl *ID = D->getClassInterface();
320 IgnoreResults = true;
325 // Ideally we would use 'GenObjCMethod', but this is such a hot path
326 // for Objective-C code that we don't want to use
327 // DeclarationName::getAsString().
328 Out << (D->isInstanceMethod() ? "(im)" : "(cm)")
329 << DeclarationName(D->getSelector());
332 void USRGenerator::VisitObjCContainerDecl(const ObjCContainerDecl *D) {
333 switch (D->getKind()) {
335 llvm_unreachable("Invalid ObjC container.");
336 case Decl::ObjCInterface:
337 case Decl::ObjCImplementation:
338 GenObjCClass(D->getName());
340 case Decl::ObjCCategory: {
341 const ObjCCategoryDecl *CD = cast<ObjCCategoryDecl>(D);
342 const ObjCInterfaceDecl *ID = CD->getClassInterface();
344 // Handle invalid code where the @interface might not
345 // have been specified.
346 // FIXME: We should be able to generate this USR even if the
347 // @interface isn't available.
348 IgnoreResults = true;
351 // Specially handle class extensions, which are anonymous categories.
352 // We want to mangle in the location to uniquely distinguish them.
353 if (CD->IsClassExtension()) {
354 Out << "objc(ext)" << ID->getName() << '@';
355 GenLoc(CD, /*IncludeOffset=*/true);
358 GenObjCCategory(ID->getName(), CD->getName());
362 case Decl::ObjCCategoryImpl: {
363 const ObjCCategoryImplDecl *CD = cast<ObjCCategoryImplDecl>(D);
364 const ObjCInterfaceDecl *ID = CD->getClassInterface();
366 // Handle invalid code where the @interface might not
367 // have been specified.
368 // FIXME: We should be able to generate this USR even if the
369 // @interface isn't available.
370 IgnoreResults = true;
373 GenObjCCategory(ID->getName(), CD->getName());
376 case Decl::ObjCProtocol:
377 GenObjCProtocol(cast<ObjCProtocolDecl>(D)->getName());
382 void USRGenerator::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) {
383 // The USR for a property declared in a class extension or category is based
384 // on the ObjCInterfaceDecl, not the ObjCCategoryDecl.
385 if (const ObjCInterfaceDecl *ID = Context->getObjContainingInterface(D))
388 Visit(cast<Decl>(D->getDeclContext()));
389 GenObjCProperty(D->getName());
392 void USRGenerator::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
393 if (ObjCPropertyDecl *PD = D->getPropertyDecl()) {
394 VisitObjCPropertyDecl(PD);
398 IgnoreResults = true;
401 void USRGenerator::VisitTagDecl(const TagDecl *D) {
402 // Add the location of the tag decl to handle resolution across
403 // translation units.
404 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
407 D = D->getCanonicalDecl();
408 VisitDeclContext(D->getDeclContext());
410 bool AlreadyStarted = false;
411 if (const CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(D)) {
412 if (ClassTemplateDecl *ClassTmpl = CXXRecord->getDescribedClassTemplate()) {
413 AlreadyStarted = true;
415 switch (D->getTagKind()) {
417 case TTK_Struct: Out << "@ST"; break;
418 case TTK_Class: Out << "@CT"; break;
419 case TTK_Union: Out << "@UT"; break;
420 case TTK_Enum: llvm_unreachable("enum template");
422 VisitTemplateParameterList(ClassTmpl->getTemplateParameters());
423 } else if (const ClassTemplatePartialSpecializationDecl *PartialSpec
424 = dyn_cast<ClassTemplatePartialSpecializationDecl>(CXXRecord)) {
425 AlreadyStarted = true;
427 switch (D->getTagKind()) {
429 case TTK_Struct: Out << "@SP"; break;
430 case TTK_Class: Out << "@CP"; break;
431 case TTK_Union: Out << "@UP"; break;
432 case TTK_Enum: llvm_unreachable("enum partial specialization");
434 VisitTemplateParameterList(PartialSpec->getTemplateParameters());
438 if (!AlreadyStarted) {
439 switch (D->getTagKind()) {
441 case TTK_Struct: Out << "@S"; break;
442 case TTK_Class: Out << "@C"; break;
443 case TTK_Union: Out << "@U"; break;
444 case TTK_Enum: Out << "@E"; break;
450 assert(Buf.size() > 0);
451 const unsigned off = Buf.size() - 1;
453 if (EmitDeclName(D)) {
454 if (const TypedefNameDecl *TD = D->getTypedefNameForAnonDecl()) {
462 // For a class template specialization, mangle the template arguments.
463 if (const ClassTemplateSpecializationDecl *Spec
464 = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
465 const TemplateArgumentList &Args = Spec->getTemplateInstantiationArgs();
467 for (unsigned I = 0, N = Args.size(); I != N; ++I) {
469 VisitTemplateArgument(Args.get(I));
474 void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) {
475 if (ShouldGenerateLocation(D) && GenLoc(D, /*IncludeOffset=*/isLocal(D)))
477 const DeclContext *DC = D->getDeclContext();
478 if (const NamedDecl *DCN = dyn_cast<NamedDecl>(DC))
484 void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) {
485 GenLoc(D, /*IncludeOffset=*/true);
489 bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) {
491 return IgnoreResults;
494 // Guard against null declarations in invalid code.
496 IgnoreResults = true;
500 // Use the location of canonical decl.
501 D = D->getCanonicalDecl();
504 IgnoreResults || printLoc(Out, D->getLocStart(),
505 Context->getSourceManager(), IncludeOffset);
507 return IgnoreResults;
510 void USRGenerator::VisitType(QualType T) {
511 // This method mangles in USR information for types. It can possibly
512 // just reuse the naming-mangling logic used by codegen, although the
513 // requirements for USRs might not be the same.
514 ASTContext &Ctx = *Context;
517 T = Ctx.getCanonicalType(T);
518 Qualifiers Q = T.getQualifiers();
527 Out << ((char) ('0' + qVal));
529 // Mangle in ObjC GC qualifiers?
531 if (const PackExpansionType *Expansion = T->getAs<PackExpansionType>()) {
533 T = Expansion->getPattern();
536 if (const BuiltinType *BT = T->getAs<BuiltinType>()) {
537 unsigned char c = '\0';
538 switch (BT->getKind()) {
539 case BuiltinType::Void:
541 case BuiltinType::Bool:
543 case BuiltinType::Char_U:
544 case BuiltinType::UChar:
546 case BuiltinType::Char16:
548 case BuiltinType::Char32:
550 case BuiltinType::UShort:
552 case BuiltinType::UInt:
554 case BuiltinType::ULong:
556 case BuiltinType::ULongLong:
558 case BuiltinType::UInt128:
560 case BuiltinType::Char_S:
561 case BuiltinType::SChar:
563 case BuiltinType::WChar_S:
564 case BuiltinType::WChar_U:
566 case BuiltinType::Short:
568 case BuiltinType::Int:
570 case BuiltinType::Long:
572 case BuiltinType::LongLong:
574 case BuiltinType::Int128:
576 case BuiltinType::Half:
578 case BuiltinType::Float:
580 case BuiltinType::Double:
582 case BuiltinType::LongDouble:
584 case BuiltinType::NullPtr:
586 #define BUILTIN_TYPE(Id, SingletonId)
587 #define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
588 #include "clang/AST/BuiltinTypes.def"
589 case BuiltinType::Dependent:
590 case BuiltinType::OCLImage1d:
591 case BuiltinType::OCLImage1dArray:
592 case BuiltinType::OCLImage1dBuffer:
593 case BuiltinType::OCLImage2d:
594 case BuiltinType::OCLImage2dArray:
595 case BuiltinType::OCLImage3d:
596 case BuiltinType::OCLEvent:
597 case BuiltinType::OCLSampler:
598 IgnoreResults = true;
600 case BuiltinType::ObjCId:
602 case BuiltinType::ObjCClass:
604 case BuiltinType::ObjCSel:
611 // If we have already seen this (non-built-in) type, use a substitution
613 llvm::DenseMap<const Type *, unsigned>::iterator Substitution
614 = TypeSubstitutions.find(T.getTypePtr());
615 if (Substitution != TypeSubstitutions.end()) {
616 Out << 'S' << Substitution->second << '_';
619 // Record this as a substitution.
620 unsigned Number = TypeSubstitutions.size();
621 TypeSubstitutions[T.getTypePtr()] = Number;
624 if (const PointerType *PT = T->getAs<PointerType>()) {
626 T = PT->getPointeeType();
629 if (const ReferenceType *RT = T->getAs<ReferenceType>()) {
631 T = RT->getPointeeType();
634 if (const FunctionProtoType *FT = T->getAs<FunctionProtoType>()) {
636 VisitType(FT->getReturnType());
637 for (const auto &I : FT->param_types())
639 if (FT->isVariadic())
643 if (const BlockPointerType *BT = T->getAs<BlockPointerType>()) {
645 T = BT->getPointeeType();
648 if (const ComplexType *CT = T->getAs<ComplexType>()) {
650 T = CT->getElementType();
653 if (const TagType *TT = T->getAs<TagType>()) {
655 VisitTagDecl(TT->getDecl());
658 if (const TemplateTypeParmType *TTP = T->getAs<TemplateTypeParmType>()) {
659 Out << 't' << TTP->getDepth() << '.' << TTP->getIndex();
662 if (const TemplateSpecializationType *Spec
663 = T->getAs<TemplateSpecializationType>()) {
665 VisitTemplateName(Spec->getTemplateName());
666 Out << Spec->getNumArgs();
667 for (unsigned I = 0, N = Spec->getNumArgs(); I != N; ++I)
668 VisitTemplateArgument(Spec->getArg(I));
678 void USRGenerator::VisitTemplateParameterList(
679 const TemplateParameterList *Params) {
682 Out << '>' << Params->size();
683 for (TemplateParameterList::const_iterator P = Params->begin(),
684 PEnd = Params->end();
687 if (isa<TemplateTypeParmDecl>(*P)) {
688 if (cast<TemplateTypeParmDecl>(*P)->isParameterPack())
694 if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) {
695 if (NTTP->isParameterPack())
698 VisitType(NTTP->getType());
702 TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*P);
703 if (TTP->isParameterPack())
706 VisitTemplateParameterList(TTP->getTemplateParameters());
710 void USRGenerator::VisitTemplateName(TemplateName Name) {
711 if (TemplateDecl *Template = Name.getAsTemplateDecl()) {
712 if (TemplateTemplateParmDecl *TTP
713 = dyn_cast<TemplateTemplateParmDecl>(Template)) {
714 Out << 't' << TTP->getDepth() << '.' << TTP->getIndex();
722 // FIXME: Visit dependent template names.
725 void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) {
726 switch (Arg.getKind()) {
727 case TemplateArgument::Null:
730 case TemplateArgument::Declaration:
731 Visit(Arg.getAsDecl());
734 case TemplateArgument::NullPtr:
737 case TemplateArgument::TemplateExpansion:
738 Out << 'P'; // pack expansion of...
740 case TemplateArgument::Template:
741 VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
744 case TemplateArgument::Expression:
745 // FIXME: Visit expressions.
748 case TemplateArgument::Pack:
749 Out << 'p' << Arg.pack_size();
750 for (const auto &P : Arg.pack_elements())
751 VisitTemplateArgument(P);
754 case TemplateArgument::Type:
755 VisitType(Arg.getAsType());
758 case TemplateArgument::Integral:
760 VisitType(Arg.getIntegralType());
761 Out << Arg.getAsIntegral();
766 //===----------------------------------------------------------------------===//
767 // USR generation functions.
768 //===----------------------------------------------------------------------===//
770 void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS) {
771 OS << "objc(cs)" << Cls;
774 void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat,
776 OS << "objc(cy)" << Cls << '@' << Cat;
779 void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) {
783 void clang::index::generateUSRForObjCMethod(StringRef Sel,
784 bool IsInstanceMethod,
786 OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel;
789 void clang::index::generateUSRForObjCProperty(StringRef Prop, raw_ostream &OS) {
790 OS << "(py)" << Prop;
793 void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS) {
794 OS << "objc(pl)" << Prot;
797 bool clang::index::generateUSRForDecl(const Decl *D,
798 SmallVectorImpl<char> &Buf) {
799 // Don't generate USRs for things with invalid locations.
800 if (!D || D->getLocStart().isInvalid())
803 USRGenerator UG(&D->getASTContext(), Buf);
805 return UG.ignoreResults();
808 bool clang::index::generateUSRForMacro(const MacroDefinition *MD,
809 const SourceManager &SM,
810 SmallVectorImpl<char> &Buf) {
811 // Don't generate USRs for things with invalid locations.
812 if (!MD || MD->getLocation().isInvalid())
815 llvm::raw_svector_ostream Out(Buf);
817 // Assume that system headers are sane. Don't put source location
818 // information into the USR if the macro comes from a system header.
819 SourceLocation Loc = MD->getLocation();
820 bool ShouldGenerateLocation = !SM.isInSystemHeader(Loc);
822 Out << getUSRSpacePrefix();
823 if (ShouldGenerateLocation)
824 printLoc(Out, Loc, SM, /*IncludeOffset=*/true);
826 Out << MD->getName()->getName();