diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-03-13 13:58:24 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-03-13 14:11:53 +0300 |
commit | 11a895b7e15d1c5a1f52706396b82e3f9db953cb (patch) | |
tree | fabc6d883b0f946151f61ae7865cee9f529a1fdd /contrib/libs/clang16/include/clang/Index/USRGeneration.h | |
parent | 9685917341315774aad5733b1793b1e533a88bbb (diff) | |
download | ydb-11a895b7e15d1c5a1f52706396b82e3f9db953cb.tar.gz |
Export clang-format16 via ydblib project
6e6be3a95868fde888d801b7590af4044049563f
Diffstat (limited to 'contrib/libs/clang16/include/clang/Index/USRGeneration.h')
-rw-r--r-- | contrib/libs/clang16/include/clang/Index/USRGeneration.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/contrib/libs/clang16/include/clang/Index/USRGeneration.h b/contrib/libs/clang16/include/clang/Index/USRGeneration.h new file mode 100644 index 0000000000..d685f2a134 --- /dev/null +++ b/contrib/libs/clang16/include/clang/Index/USRGeneration.h @@ -0,0 +1,112 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + +//===- 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 + + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif |