Coverage Report

Created: 2018-09-25 23:22

/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 Decl;
18
class MacroDefinitionRecord;
19
class Module;
20
class SourceLocation;
21
class SourceManager;
22
23
namespace index {
24
25
27.9k
static inline StringRef getUSRSpacePrefix() {
26
27.9k
  return "c:";
27
27.9k
}
28
29
/// Generate a USR for a Decl, including the USR prefix.
30
/// \returns true if the results should be ignored, false otherwise.
31
bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
32
33
/// Generate a USR fragment for an Objective-C class.
34
void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS,
35
                             StringRef ExtSymbolDefinedIn = "",
36
                             StringRef CategoryContextExtSymbolDefinedIn = "");
37
38
/// Generate a USR fragment for an Objective-C class category.
39
void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS,
40
                                StringRef ClsExtSymbolDefinedIn = "",
41
                                StringRef CatExtSymbolDefinedIn = "");
42
43
/// Generate a USR fragment for an Objective-C instance variable.  The
44
/// complete USR can be created by concatenating the USR for the
45
/// encompassing class with this USR fragment.
46
void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
47
48
/// Generate a USR fragment for an Objective-C method.
49
void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
50
                              raw_ostream &OS);
51
52
/// Generate a USR fragment for an Objective-C property.
53
void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
54
55
/// Generate a USR fragment for an Objective-C protocol.
56
void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS,
57
                                StringRef ExtSymbolDefinedIn = "");
58
59
/// Generate USR fragment for a global (non-nested) enum.
60
void generateUSRForGlobalEnum(StringRef EnumName, raw_ostream &OS,
61
                              StringRef ExtSymbolDefinedIn = "");
62
63
/// Generate a USR fragment for an enum constant.
64
void generateUSRForEnumConstant(StringRef EnumConstantName, raw_ostream &OS);
65
66
/// Generate a USR for a macro, including the USR prefix.
67
///
68
/// \returns true on error, false on success.
69
bool generateUSRForMacro(const MacroDefinitionRecord *MD,
70
                         const SourceManager &SM, SmallVectorImpl<char> &Buf);
71
bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
72
                         const SourceManager &SM, SmallVectorImpl<char> &Buf);
73
74
/// Generate a USR for a module, including the USR prefix.
75
/// \returns true on error, false on success.
76
bool generateFullUSRForModule(const Module *Mod, raw_ostream &OS);
77
78
/// Generate a USR for a top-level module name, including the USR prefix.
79
/// \returns true on error, false on success.
80
bool generateFullUSRForTopLevelModuleName(StringRef ModName, raw_ostream &OS);
81
82
/// Generate a USR fragment for a module.
83
/// \returns true on error, false on success.
84
bool generateUSRFragmentForModule(const Module *Mod, raw_ostream &OS);
85
86
/// Generate a USR fragment for a module name.
87
/// \returns true on error, false on success.
88
bool generateUSRFragmentForModuleName(StringRef ModName, raw_ostream &OS);
89
90
} // namespace index
91
} // namespace clang
92
93
#endif // LLVM_CLANG_INDEX_USRGENERATION_H
94