clang  3.9.0
USRGeneration.h
Go to the documentation of this file.
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 SourceManager;
20 
21 namespace index {
22 
23 static inline StringRef getUSRSpacePrefix() {
24  return "c:";
25 }
26 
27 /// \brief Generate a USR for a Decl, including the USR prefix.
28 /// \returns true if the results should be ignored, false otherwise.
29 bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
30 
31 /// \brief Generate a USR fragment for an Objective-C class.
32 void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS);
33 
34 /// \brief Generate a USR fragment for an Objective-C class category.
35 void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS);
36 
37 /// \brief Generate a USR fragment for an Objective-C instance variable. The
38 /// complete USR can be created by concatenating the USR for the
39 /// encompassing class with this USR fragment.
40 void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
41 
42 /// \brief Generate a USR fragment for an Objective-C method.
43 void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
44  raw_ostream &OS);
45 
46 /// \brief Generate a USR fragment for an Objective-C property.
47 void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
48 
49 /// \brief Generate a USR fragment for an Objective-C protocol.
50 void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS);
51 
52 /// \brief Generate a USR for a macro, including the USR prefix.
53 ///
54 /// \returns true on error, false on success.
57 
58 } // namespace index
59 } // namespace clang
60 
61 #endif // LLVM_CLANG_IDE_USRGENERATION_H
62 
bool generateUSRForMacro(const MacroDefinitionRecord *MD, const SourceManager &SM, SmallVectorImpl< char > &Buf)
Generate a USR for a macro, including the USR prefix.
static StringRef getUSRSpacePrefix()
Definition: USRGeneration.h:23
Record the location of a macro definition.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
const SourceManager & SM
Definition: Format.cpp:1184
void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod, raw_ostream &OS)
Generate a USR fragment for an Objective-C method.
void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS)
Generate a USR fragment for an Objective-C protocol.
void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS)
Generate a USR fragment for an Objective-C instance variable.
void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS)
Generate a USR fragment for an Objective-C property.
void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS)
Generate a USR fragment for an Objective-C class.
void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS)
Generate a USR fragment for an Objective-C class category.
bool generateUSRForDecl(const Decl *D, SmallVectorImpl< char > &Buf)
Generate a USR for a Decl, including the USR prefix.
This class handles loading and caching of source files into memory.