clang: include/clang/AST/RawCommentList.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_CLANG_AST_RAWCOMMENTLIST_H
10#define LLVM_CLANG_AST_RAWCOMMENTLIST_H
11
14#include "llvm/ADT/ArrayRef.h"
15#include "llvm/ADT/DenseMap.h"
16#include "llvm/Support/Allocator.h"
17#include
18
20
21class ASTContext;
22class ASTReader;
24class DiagnosticsEngine;
25class Preprocessor;
26class SourceManager;
27
28namespace comments {
29 class FullComment;
30}
31
33public:
42 RCK_Merged
44
46
49
52 }
53
56 }
57
60 }
61
62
64 return IsAttached;
65 }
66
68 IsAttached = true;
69 }
70
71
72
73
74
75
77 return IsTrailingComment;
78 }
79
80
81
82
84 return IsAlmostTrailingComment;
85 }
86
87
90 }
91
92
95 }
96
97
99 if (RawTextValid)
100 return RawText;
101
102 RawText = getRawTextSlow(SourceMgr);
103 RawTextValid = true;
104 return RawText;
105 }
106
110
112 if (BriefTextValid)
113 return BriefText;
114
115 return extractBriefText(Context);
116 }
117
120 return false;
122 if (Text.size() < 6 || Text[0] != '/')
123 return false;
124 if (Text[1] == '*')
125 return Text[Text.size() - 1] != '/' || Text[Text.size() - 2] != '*';
126 return Text[1] != '/';
127 }
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
152
157
160 };
161
162
163
164
167
168
171
172private:
174
175 mutable StringRef RawText;
176 mutable const char *BriefText = nullptr;
177
178 LLVM_PREFERRED_TYPE(bool)
179 mutable unsigned RawTextValid : 1;
180 LLVM_PREFERRED_TYPE(bool)
181 mutable unsigned BriefTextValid : 1;
182
184 unsigned Kind : 3;
185
186
187 LLVM_PREFERRED_TYPE(bool)
188 unsigned IsAttached : 1;
189
190 LLVM_PREFERRED_TYPE(bool)
191 unsigned IsTrailingComment : 1;
192 LLVM_PREFERRED_TYPE(bool)
193 unsigned IsAlmostTrailingComment : 1;
194
195
197 bool IsAlmostTrailingComment) :
198 Range(SR), RawTextValid(false), BriefTextValid(false), Kind(K),
199 IsAttached(false), IsTrailingComment(IsTrailingComment),
200 IsAlmostTrailingComment(IsAlmostTrailingComment)
201 { }
202
203 StringRef getRawTextSlow(const SourceManager &SourceMgr) const;
204
205 const char *extractBriefText(const ASTContext &Context) const;
206
208};
209
210
211
213public:
215
217 llvm::BumpPtrAllocator &Allocator);
218
219
220
222
223 bool empty() const;
224
226 unsigned Offset) const;
228
229private:
231
232 llvm::DenseMap<FileID, std::map<unsigned, RawComment *>> OrderedComments;
233 mutable llvm::DenseMap<RawComment *, unsigned> CommentBeginLine;
234 mutable llvm::DenseMap<RawComment *, unsigned> CommentEndOffset;
235
238};
239
240}
241
242#endif
Defines the clang::SourceLocation class and associated facilities.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
Writes an AST file containing the contents of a translation unit.
Decl - This represents one declaration (or definition), e.g.
Concrete class used by the front-end to report problems and issues.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Represents an unpacked "presumed" location which can be presented to the user.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.