diff options
| author | Ralf Luther <luther.ralf@gmail.com> | 2019-03-27 20:23:17 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit2@aicp-server-3> | 2019-03-27 20:23:17 +0000 |
| commit | 1ce3a9d272e564b22a1333a1e36a3d3ab7cfab01 (patch) | |
| tree | 391382eadd4fec5bb480f2e8934fa352770221d1 /clang-r353983/include/clang/Index/USRGeneration.h | |
| parent | d1d48b140bafaa8a50107292f5fce95562575765 (diff) | |
| parent | 4f56932d3416ac03f646bc1a611b3135fec2fe08 (diff) | |
Merge "Update prebuilt Clang to r353983." into p9.0HEADp9.0-backupp9.0
Diffstat (limited to 'clang-r353983/include/clang/Index/USRGeneration.h')
| -rw-r--r-- | clang-r353983/include/clang/Index/USRGeneration.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/clang-r353983/include/clang/Index/USRGeneration.h b/clang-r353983/include/clang/Index/USRGeneration.h new file mode 100644 index 00000000..f89fc5cf --- /dev/null +++ b/clang-r353983/include/clang/Index/USRGeneration.h @@ -0,0 +1,101 @@ +//===- USRGeneration.h - Routines for USR generation ------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_INDEX_USRGENERATION_H +#define LLVM_CLANG_INDEX_USRGENERATION_H + +#include "clang/Basic/LLVM.h" +#include "llvm/ADT/StringRef.h" + +namespace clang { +class ASTContext; +class Decl; +class MacroDefinitionRecord; +class Module; +class SourceLocation; +class SourceManager; +class QualType; + +namespace index { + +static inline StringRef getUSRSpacePrefix() { + return "c:"; +} + +/// Generate a USR for a Decl, including the USR prefix. +/// \returns true if the results should be ignored, false otherwise. +bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf); + +/// Generate a USR fragment for an Objective-C class. +void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = "", + StringRef CategoryContextExtSymbolDefinedIn = ""); + +/// Generate a USR fragment for an Objective-C class category. +void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS, + StringRef ClsExtSymbolDefinedIn = "", + StringRef CatExtSymbolDefinedIn = ""); + +/// Generate a USR fragment for an Objective-C instance variable. The +/// complete USR can be created by concatenating the USR for the +/// encompassing class with this USR fragment. +void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS); + +/// Generate a USR fragment for an Objective-C method. +void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod, + raw_ostream &OS); + +/// Generate a USR fragment for an Objective-C property. +void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS); + +/// Generate a USR fragment for an Objective-C protocol. +void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate USR fragment for a global (non-nested) enum. +void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS, + StringRef ExtSymbolDefinedIn = ""); + +/// Generate a USR fragment for an enum constant. +void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS); + +/// Generate a USR for a macro, including the USR prefix. +/// +/// \returns true on error, false on success. +bool generateUSRForMacro(const MacroDefinitionRecord *MD, + const SourceManager &SM, SmallVectorImpl<char> &Buf); +bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc, + const SourceManager &SM, SmallVectorImpl<char> &Buf); + +/// Generates a USR for a type. +/// +/// \return true on error, false on success. +bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl<char> &Buf); + +/// Generate a USR for a module, including the USR prefix. +/// \returns true on error, false on success. +bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS); + +/// Generate a USR for a top-level module name, including the USR prefix. +/// \returns true on error, false on success. +bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS); + +/// Generate a USR fragment for a module. +/// \returns true on error, false on success. +bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS); + +/// Generate a USR fragment for a module name. +/// \returns true on error, false on success. +bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS); + + +} // namespace index +} // namespace clang + +#endif // LLVM_CLANG_INDEX_USRGENERATION_H + |
