clang-tools 8.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::unique_ptr<Info> emitInfo(const NamespaceDecl *D, const FullComment *FC,
32 int LineNumber, StringRef File, bool PublicOnly);
33 std::unique_ptr<Info> emitInfo(const RecordDecl *D, const FullComment *FC,
34 int LineNumber, StringRef File, bool PublicOnly);
35 std::unique_ptr<Info> emitInfo(const EnumDecl *D, const FullComment *FC,
36 int LineNumber, StringRef File, bool PublicOnly);
37 std::unique_ptr<Info> emitInfo(const FunctionDecl *D, const FullComment *FC,
38 int LineNumber, StringRef File, bool PublicOnly);
39 std::unique_ptr<Info> 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 std::string serialize(std::unique_ptr<Info> &I);
50
51 } // namespace serialize
52 } // namespace doc
53 } // namespace clang
54
55 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_SERIALIZE_H
Representation.h
clang::doc::serialize::emitInfo
std::unique_ptr< Info > emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber, StringRef File, bool PublicOnly)
PublicOnly
static llvm::cl::opt< bool > PublicOnly("public", llvm::cl::desc("Document only public declarations."), llvm::cl::init(false), llvm::cl::cat(ClangDocCategory))
clang::doc::serialize::serialize
static std::string serialize(T &I)
Definition: Serialize.cpp:147
D
const Decl * D
Definition: XRefs.cpp:79
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
comments
clang::doc::SymbolID
std::array< uint8_t, 20 > SymbolID
Definition: Representation.h:31
clang::doc::serialize::hashUSR
SymbolID hashUSR(llvm::StringRef USR)
Definition: Serialize.cpp:24