]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/clang/Index/USRGeneration.h
Vendor import of clang trunk r300422:
[FreeBSD/FreeBSD.git] / include / clang / Index / USRGeneration.h
1 //===- USRGeneration.h - Routines for USR generation ----------------------===//
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 SourceLocation;
20 class SourceManager;
21
22 namespace index {
23
24 static inline StringRef getUSRSpacePrefix() {
25   return "c:";
26 }
27
28 /// \brief Generate a USR for a Decl, including the USR prefix.
29 /// \returns true if the results should be ignored, false otherwise.
30 bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
31
32 /// \brief Generate a USR fragment for an Objective-C class.
33 void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS);
34
35 /// \brief Generate a USR fragment for an Objective-C class category.
36 void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS);
37
38 /// \brief Generate a USR fragment for an Objective-C instance variable.  The
39 /// complete USR can be created by concatenating the USR for the
40 /// encompassing class with this USR fragment.
41 void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
42
43 /// \brief Generate a USR fragment for an Objective-C method.
44 void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
45                               raw_ostream &OS);
46
47 /// \brief Generate a USR fragment for an Objective-C property.
48 void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
49
50 /// \brief Generate a USR fragment for an Objective-C protocol.
51 void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS);
52
53 /// \brief Generate a USR for a macro, including the USR prefix.
54 ///
55 /// \returns true on error, false on success.
56 bool generateUSRForMacro(const MacroDefinitionRecord *MD,
57                          const SourceManager &SM, SmallVectorImpl<char> &Buf);
58 bool generateUSRForMacro(StringRef MacroName, SourceLocation Loc,
59                          const SourceManager &SM, SmallVectorImpl<char> &Buf);
60
61 } // namespace index
62 } // namespace clang
63
64 #endif // LLVM_CLANG_IDE_USRGENERATION_H
65