Skip to content

Commit 088932d

Browse files
committed
[clang][NFC] Annotate AST/Comment.h with preferred_type
Also declare `InlineCommandRenderKind` as scoped enum, which 565e21b forgot to do.
1 parent 339f5f7 commit 088932d

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

clang/include/clang/AST/Comment.h

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class TemplateParameterList;
2727

2828
namespace comments {
2929
class FullComment;
30+
enum class InlineCommandRenderKind;
31+
enum class ParamCommandPassDirection;
3032

3133
/// Describes the syntax that was used in a documentation command.
3234
///
@@ -72,41 +74,50 @@ class Comment {
7274
friend class Comment;
7375

7476
/// Type of this AST node.
77+
LLVM_PREFERRED_TYPE(CommentKind)
7578
unsigned Kind : 8;
7679
};
7780
enum { NumCommentBits = 8 };
7881

7982
class InlineContentCommentBitfields {
8083
friend class InlineContentComment;
8184

85+
LLVM_PREFERRED_TYPE(CommentBitfields)
8286
unsigned : NumCommentBits;
8387

8488
/// True if there is a newline after this inline content node.
8589
/// (There is no separate AST node for a newline.)
90+
LLVM_PREFERRED_TYPE(bool)
8691
unsigned HasTrailingNewline : 1;
8792
};
8893
enum { NumInlineContentCommentBits = NumCommentBits + 1 };
8994

9095
class TextCommentBitfields {
9196
friend class TextComment;
9297

98+
LLVM_PREFERRED_TYPE(InlineContentCommentBitfields)
9399
unsigned : NumInlineContentCommentBits;
94100

95101
/// True if \c IsWhitespace field contains a valid value.
102+
LLVM_PREFERRED_TYPE(bool)
96103
mutable unsigned IsWhitespaceValid : 1;
97104

98105
/// True if this comment AST node contains only whitespace.
106+
LLVM_PREFERRED_TYPE(bool)
99107
mutable unsigned IsWhitespace : 1;
100108
};
101109
enum { NumTextCommentBits = NumInlineContentCommentBits + 2 };
102110

103111
class InlineCommandCommentBitfields {
104112
friend class InlineCommandComment;
105113

114+
LLVM_PREFERRED_TYPE(InlineContentCommentBitfields)
106115
unsigned : NumInlineContentCommentBits;
107116

117+
LLVM_PREFERRED_TYPE(InlineCommandRenderKind)
108118
unsigned RenderKind : 3;
109119

120+
LLVM_PREFERRED_TYPE(CommandTraits::KnownCommandIDs)
110121
unsigned CommandID : CommandInfo::NumCommandIDBits;
111122
};
112123
enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 3 +
@@ -115,46 +126,56 @@ class Comment {
115126
class HTMLTagCommentBitfields {
116127
friend class HTMLTagComment;
117128

129+
LLVM_PREFERRED_TYPE(InlineContentCommentBitfields)
118130
unsigned : NumInlineContentCommentBits;
119131

120132
/// True if we found that this tag is malformed in some way.
133+
LLVM_PREFERRED_TYPE(bool)
121134
unsigned IsMalformed : 1;
122135
};
123136
enum { NumHTMLTagCommentBits = NumInlineContentCommentBits + 1 };
124137

125138
class HTMLStartTagCommentBitfields {
126139
friend class HTMLStartTagComment;
127140

141+
LLVM_PREFERRED_TYPE(HTMLTagCommentBitfields)
128142
unsigned : NumHTMLTagCommentBits;
129143

130144
/// True if this tag is self-closing (e. g., <br />). This is based on tag
131145
/// spelling in comment (plain <br> would not set this flag).
146+
LLVM_PREFERRED_TYPE(bool)
132147
unsigned IsSelfClosing : 1;
133148
};
134149
enum { NumHTMLStartTagCommentBits = NumHTMLTagCommentBits + 1 };
135150

136151
class ParagraphCommentBitfields {
137152
friend class ParagraphComment;
138153

154+
LLVM_PREFERRED_TYPE(CommentBitfields)
139155
unsigned : NumCommentBits;
140156

141157
/// True if \c IsWhitespace field contains a valid value.
158+
LLVM_PREFERRED_TYPE(bool)
142159
mutable unsigned IsWhitespaceValid : 1;
143160

144161
/// True if this comment AST node contains only whitespace.
162+
LLVM_PREFERRED_TYPE(bool)
145163
mutable unsigned IsWhitespace : 1;
146164
};
147165
enum { NumParagraphCommentBits = NumCommentBits + 2 };
148166

149167
class BlockCommandCommentBitfields {
150168
friend class BlockCommandComment;
151169

170+
LLVM_PREFERRED_TYPE(CommentBitfields)
152171
unsigned : NumCommentBits;
153172

173+
LLVM_PREFERRED_TYPE(CommandTraits::KnownCommandIDs)
154174
unsigned CommandID : CommandInfo::NumCommandIDBits;
155175

156176
/// Describes the syntax that was used in a documentation command.
157177
/// Contains values from CommandMarkerKind enum.
178+
LLVM_PREFERRED_TYPE(CommandMarkerKind)
158179
unsigned CommandMarker : 1;
159180
};
160181
enum { NumBlockCommandCommentBits = NumCommentBits +
@@ -163,12 +184,15 @@ class Comment {
163184
class ParamCommandCommentBitfields {
164185
friend class ParamCommandComment;
165186

187+
LLVM_PREFERRED_TYPE(BlockCommandCommentBitfields)
166188
unsigned : NumBlockCommandCommentBits;
167189

168-
/// Parameter passing direction, see ParamCommandComment::PassDirection.
190+
/// Parameter passing direction.
191+
LLVM_PREFERRED_TYPE(ParamCommandPassDirection)
169192
unsigned Direction : 2;
170193

171194
/// True if direction was specified explicitly in the comment.
195+
LLVM_PREFERRED_TYPE(bool)
172196
unsigned IsDirectionExplicit : 1;
173197
};
174198
enum { NumParamCommandCommentBits = NumBlockCommandCommentBits + 3 };
@@ -299,7 +323,13 @@ class TextComment : public InlineContentComment {
299323

300324
/// The most appropriate rendering mode for this command, chosen on command
301325
/// semantics in Doxygen.
302-
enum InlineCommandRenderKind { Normal, Bold, Monospaced, Emphasized, Anchor };
326+
enum class InlineCommandRenderKind {
327+
Normal,
328+
Bold,
329+
Monospaced,
330+
Emphasized,
331+
Anchor
332+
};
303333

304334
/// A command with word-like arguments that is considered inline content.
305335
class InlineCommandComment : public InlineContentComment {
@@ -1005,28 +1035,35 @@ struct DeclInfo {
10051035
};
10061036

10071037
/// If false, only \c CommentDecl is valid.
1038+
LLVM_PREFERRED_TYPE(bool)
10081039
unsigned IsFilled : 1;
10091040

10101041
/// Simplified kind of \c CommentDecl, see \c DeclKind enum.
1042+
LLVM_PREFERRED_TYPE(DeclKind)
10111043
unsigned Kind : 3;
10121044

10131045
/// Is \c CommentDecl a template declaration.
1046+
LLVM_PREFERRED_TYPE(TemplateDeclKind)
10141047
unsigned TemplateKind : 2;
10151048

10161049
/// Is \c CommentDecl an ObjCMethodDecl.
1050+
LLVM_PREFERRED_TYPE(bool)
10171051
unsigned IsObjCMethod : 1;
10181052

10191053
/// Is \c CommentDecl a non-static member function of C++ class or
10201054
/// instance method of ObjC class.
10211055
/// Can be true only if \c IsFunctionDecl is true.
1056+
LLVM_PREFERRED_TYPE(bool)
10221057
unsigned IsInstanceMethod : 1;
10231058

10241059
/// Is \c CommentDecl a static member function of C++ class or
10251060
/// class method of ObjC class.
10261061
/// Can be true only if \c IsFunctionDecl is true.
1062+
LLVM_PREFERRED_TYPE(bool)
10271063
unsigned IsClassMethod : 1;
10281064

10291065
/// Is \c CommentDecl something we consider a "function" that's variadic.
1066+
LLVM_PREFERRED_TYPE(bool)
10301067
unsigned IsVariadic : 1;
10311068

10321069
void fill();

0 commit comments

Comments
 (0)