clang-tools  7.0.0
Serialize.h
Go to the documentation of this file.
1 //===-- Serializer.h - ClangDoc Serializer ----------------------*- 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 // This file implements the serializing functions fro the clang-doc tool. Given
11 // a particular declaration, it collects the appropriate information and returns
12 // a serialized bitcode string for the declaration.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_SERIALIZE_H
17 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_SERIALIZE_H
18 
19 #include "Representation.h"
20 #include "clang/AST/AST.h"
21 #include "clang/AST/CommentVisitor.h"
22 #include <string>
23 #include <vector>
24 
25 using namespace clang::comments;
26 
27 namespace clang {
28 namespace doc {
29 namespace serialize {
30 
31 std::string emitInfo(const NamespaceDecl *D, const FullComment *FC,
32  int LineNumber, StringRef File, bool PublicOnly);
33 std::string emitInfo(const RecordDecl *D, const FullComment *FC, int LineNumber,
34  StringRef File, bool PublicOnly);
35 std::string emitInfo(const EnumDecl *D, const FullComment *FC, int LineNumber,
36  StringRef File, bool PublicOnly);
37 std::string emitInfo(const FunctionDecl *D, const FullComment *FC,
38  int LineNumber, StringRef File, bool PublicOnly);
39 std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC,
40  int LineNumber, StringRef File, bool PublicOnly);
41 
42 // Function to hash a given USR value for storage.
43 // As USRs (Unified Symbol Resolution) could be large, especially for functions
44 // with long type arguments, we use 160-bits SHA1(USR) values to
45 // guarantee the uniqueness of symbols while using a relatively small amount of
46 // memory (vs storing USRs directly).
47 SymbolID hashUSR(llvm::StringRef USR);
48 
49 } // namespace serialize
50 } // namespace doc
51 } // namespace clang
52 
53 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_SERIALIZE_H
static llvm::cl::opt< bool > PublicOnly("public", llvm::cl::desc("Document only public declarations."), llvm::cl::init(false), llvm::cl::cat(ClangDocCategory))
static std::string serialize(T &I)
Definition: Serialize.cpp:147
std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber, StringRef File, bool PublicOnly)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
std::array< uint8_t, 20 > SymbolID
SymbolID hashUSR(llvm::StringRef USR)
Definition: Serialize.cpp:24