clang-tools
7.0.0
llvm.src
tools
clang
tools
extra
clang-doc
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
Representation.h
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
clang::doc::serialize::emitInfo
std::string emitInfo(const CXXMethodDecl *D, const FullComment *FC, int LineNumber, StringRef File, bool PublicOnly)
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition:
ChangeNamespace.cpp:16
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
Generated on Mon Sep 17 2018 14:01:20 for clang-tools by
1.8.13