clang API Documentation

USRGeneration.h
Go to the documentation of this file.
00001 //===- USRGeneration.h - Routines for USR generation ----------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_CLANG_INDEX_USRGENERATION_H
00011 #define LLVM_CLANG_INDEX_USRGENERATION_H
00012 
00013 #include "clang/Basic/LLVM.h"
00014 #include "llvm/ADT/StringRef.h"
00015 
00016 namespace clang {
00017 class Decl;
00018 class MacroDefinition;
00019 class SourceManager;
00020 
00021 namespace index {
00022 
00023 static inline StringRef getUSRSpacePrefix() {
00024   return "c:";
00025 }
00026 
00027 /// \brief Generate a USR for a Decl, including the USR prefix.
00028 /// \returns true if the results should be ignored, false otherwise.
00029 bool generateUSRForDecl(const Decl *D, SmallVectorImpl<char> &Buf);
00030 
00031 /// \brief Generate a USR fragment for an Objective-C class.
00032 void generateUSRForObjCClass(StringRef Cls, raw_ostream &OS);
00033 
00034 /// \brief Generate a USR fragment for an Objective-C class category.
00035 void generateUSRForObjCCategory(StringRef Cls, StringRef Cat, raw_ostream &OS);
00036 
00037 /// \brief Generate a USR fragment for an Objective-C instance variable.  The
00038 /// complete USR can be created by concatenating the USR for the
00039 /// encompassing class with this USR fragment.
00040 void generateUSRForObjCIvar(StringRef Ivar, raw_ostream &OS);
00041 
00042 /// \brief Generate a USR fragment for an Objective-C method.
00043 void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod,
00044                               raw_ostream &OS);
00045 
00046 /// \brief Generate a USR fragment for an Objective-C property.
00047 void generateUSRForObjCProperty(StringRef Prop, raw_ostream &OS);
00048 
00049 /// \brief Generate a USR fragment for an Objective-C protocol.
00050 void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS);
00051 
00052 /// \brief Generate a USR for a macro, including the USR prefix.
00053 ///
00054 /// \returns true on error, false on success.
00055 bool generateUSRForMacro(const MacroDefinition *MD, const SourceManager &SM,
00056                          SmallVectorImpl<char> &Buf);
00057 
00058 } // namespace index
00059 } // namespace clang
00060 
00061 #endif // LLVM_CLANG_IDE_USRGENERATION_H
00062