Coverage Report

Created: 2018-12-11 17:59

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/Index/USRGeneration.h
Line
Count
Source
1
//===- USRGeneration.h - Routines for USR generation ------------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef LLVM_CLANG_INDEX_USRGENERATION_H
11
#define LLVM_CLANG_INDEX_USRGENERATION_H
12
13
#include "clang/Basic/LLVM.h"
14
#include "llvm/ADT/StringRef.h"
15
16
namespace clang {
17
class ASTContext;
18
class Decl;
19
class MacroDefinitionRecord;
20
class Module;
21
class SourceLocation;
22
class SourceManager;
23
class QualType;
24
25
namespace index {
26
27
29.0k
static inline StringRef getUSRSpacePrefix() {
28
29.0k
  return "c:";
29
29.0k
}
30
31
/// Generate a USR for a Decl, including the USR prefix.
32
/// \returns true if the results should be ignored, false otherwise.
33
bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
34
35
/// Generate a USR fragment for an Objective-C class.
36
void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS,
37
                             StringRef ExtSymbolDefinedIn = "",
38
                             StringRef CategoryContextExtSymbolDefinedIn = "");
39
40
/// Generate a USR fragment for an Objective-C class category.
41
void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS,
42
                                StringRef ClsExtSymbolDefinedIn = "",
43
                                StringRef CatExtSymbolDefinedIn = "");
44
45
/// Generate a USR fragment for an Objective-C instance variable.  The
46
/// complete USR can be created by concatenating the USR for the
47
/// encompassing class with this USR fragment.
48
void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
49
50
/// Generate a USR fragment for an Objective-C method.
51
void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
52
                              raw_ostream &OS);
53
54
/// Generate a USR fragment for an Objective-C property.
55
void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
56
57
/// Generate a USR fragment for an Objective-C protocol.
58
void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS,
59
                                StringRef ExtSymbolDefinedIn = "");
60
61
/// Generate USR fragment for a global (non-nested) enum.
62
void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS,
63
                              StringRef ExtSymbolDefinedIn = "");
64
65
/// Generate a USR fragment for an enum constant.
66
void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS);
67
68
/// Generate a USR for a macro, including the USR prefix.
69
///
70
/// \returns true on error, false on success.
71
bool generateUSRForMacro(const MacroDefinitionRecord *MD,
72
                         const SourceManager &SM, SmallVectorImpl<char> &Buf);
73
bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
74
                         const SourceManager &SM, SmallVectorImpl<char> &Buf);
75
76
/// Generates a USR for a type.
77
///
78
/// \return true on error, false on success.
79
bool generateUSRForType(QualType T, ASTContext &Ctx, SmallVectorImpl<char> &Buf);
80
81
/// Generate a USR for a module, including the USR prefix.
82
/// \returns true on error, false on success.
83
bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS);
84
85
/// Generate a USR for a top-level module name, including the USR prefix.
86
/// \returns true on error, false on success.
87
bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS);
88
89
/// Generate a USR fragment for a module.
90
/// \returns true on error, false on success.
91
bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS);
92
93
/// Generate a USR fragment for a module name.
94
/// \returns true on error, false on success.
95
bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS);
96
97
98
} // namespace index
99
} // namespace clang
100
101
#endif // LLVM_CLANG_INDEX_USRGENERATION_H
102