#include "clang/Index/USRGeneration.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/AST/ODRHash.h"
#include "clang/Basic/FileManager.h"
#include "clang/Lex/PreprocessingRecord.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
usingnamespaceclang;
usingnamespaceclang::index;
static bool printLoc(llvm::raw_ostream &OS, SourceLocation Loc,
const SourceManager &SM, bool IncludeOffset) { … }
static StringRef GetExternalSourceContainer(const NamedDecl *D) { … }
namespace {
class USRGenerator : public ConstDeclVisitor<USRGenerator> { … };
}
bool USRGenerator::EmitDeclName(const NamedDecl *D) { … }
bool USRGenerator::ShouldGenerateLocation(const NamedDecl *D) { … }
void USRGenerator::VisitDeclContext(const DeclContext *DC) { … }
void USRGenerator::VisitFieldDecl(const FieldDecl *D) { … }
void USRGenerator::VisitFunctionDecl(const FunctionDecl *D) { … }
void USRGenerator::VisitNamedDecl(const NamedDecl *D) { … }
void USRGenerator::VisitVarDecl(const VarDecl *D) { … }
void USRGenerator::VisitBindingDecl(const BindingDecl *D) { … }
void USRGenerator::VisitNonTypeTemplateParmDecl(
const NonTypeTemplateParmDecl *D) { … }
void USRGenerator::VisitTemplateTemplateParmDecl(
const TemplateTemplateParmDecl *D) { … }
void USRGenerator::VisitNamespaceDecl(const NamespaceDecl *D) { … }
void USRGenerator::VisitFunctionTemplateDecl(const FunctionTemplateDecl *D) { … }
void USRGenerator::VisitClassTemplateDecl(const ClassTemplateDecl *D) { … }
void USRGenerator::VisitNamespaceAliasDecl(const NamespaceAliasDecl *D) { … }
static const ObjCCategoryDecl *getCategoryContext(const NamedDecl *D) { … }
void USRGenerator::VisitObjCMethodDecl(const ObjCMethodDecl *D) { … }
void USRGenerator::VisitObjCContainerDecl(const ObjCContainerDecl *D,
const ObjCCategoryDecl *CatD) { … }
void USRGenerator::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) { … }
void USRGenerator::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { … }
void USRGenerator::VisitTagDecl(const TagDecl *D) { … }
void USRGenerator::VisitTypedefDecl(const TypedefDecl *D) { … }
void USRGenerator::VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D) { … }
void USRGenerator::GenExtSymbolContainer(const NamedDecl *D) { … }
bool USRGenerator::GenLoc(const Decl *D, bool IncludeOffset) { … }
static void printQualifier(llvm::raw_ostream &Out, ASTContext &Ctx, NestedNameSpecifier *NNS) { … }
void USRGenerator::VisitType(QualType T) { … }
void USRGenerator::VisitTemplateParameterList(
const TemplateParameterList *Params) { … }
void USRGenerator::VisitTemplateName(TemplateName Name) { … }
void USRGenerator::VisitTemplateArgument(const TemplateArgument &Arg) { … }
void USRGenerator::VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D) { … }
void USRGenerator::VisitUnresolvedUsingTypenameDecl(const UnresolvedUsingTypenameDecl *D) { … }
void USRGenerator::VisitConceptDecl(const ConceptDecl *D) { … }
void USRGenerator::VisitMSGuidDecl(const MSGuidDecl *D) { … }
static void combineClassAndCategoryExtContainers(StringRef ClsSymDefinedIn,
StringRef CatSymDefinedIn,
raw_ostream &OS) { … }
void clang::index::generateUSRForObjCClass(StringRef Cls, raw_ostream &OS,
StringRef ExtSymDefinedIn,
StringRef CategoryContextExtSymbolDefinedIn) { … }
void clang::index::generateUSRForObjCCategory(StringRef Cls, StringRef Cat,
raw_ostream &OS,
StringRef ClsSymDefinedIn,
StringRef CatSymDefinedIn) { … }
void clang::index::generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS) { … }
void clang::index::generateUSRForObjCMethod(StringRef Sel,
bool IsInstanceMethod,
raw_ostream &OS) { … }
void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp,
raw_ostream &OS) { … }
void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS,
StringRef ExtSymDefinedIn) { … }
void clang::index::generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS,
StringRef ExtSymDefinedIn) { … }
void clang::index::generateUSRForEnumConstant(StringRef EnumConstantName,
raw_ostream &OS) { … }
bool clang::index::generateUSRForDecl(const Decl *D,
SmallVectorImpl<char> &Buf) { … }
bool clang::index::generateUSRForMacro(const MacroDefinitionRecord *MD,
const SourceManager &SM,
SmallVectorImpl<char> &Buf) { … }
bool clang::index::generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
const SourceManager &SM,
SmallVectorImpl<char> &Buf) { … }
bool clang::index::generateUSRForType(QualType T, ASTContext &Ctx,
SmallVectorImpl<char> &Buf) { … }
bool clang::index::generateFullUSRForModule(const Module *Mod,
raw_ostream &OS) { … }
bool clang::index::generateFullUSRForTopLevelModuleName(StringRef ModName,
raw_ostream &OS) { … }
bool clang::index::generateUSRFragmentForModule(const Module *Mod,
raw_ostream &OS) { … }
bool clang::index::generateUSRFragmentForModuleName(StringRef ModName,
raw_ostream &OS) { … }