Skip to content

Commit 711b46d

Browse files
Improve better security with readonly comments (#1962)
1 parent 9244160 commit 711b46d

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

src/CppParser/Comments.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,63 +91,63 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C, clang::Compiler
9191
// This needs to have an underscore else we get an ICE under VS2012.
9292
CppSharp::CppParser::AST::Comment* _Comment = nullptr;
9393
auto kind = C->getCommentKind();
94-
if (auto CK = dyn_cast<const comments::FullComment>(C))
94+
if (const auto* CK = dyn_cast<const comments::FullComment>(C))
9595
{
96-
auto FC = new FullComment();
96+
auto* FC = new FullComment();
9797
_Comment = FC;
9898
for (auto I = CK->child_begin(), E = CK->child_end(); I != E; ++I)
9999
FC->Blocks.push_back(static_cast<BlockContentComment*>(ConvertCommentBlock(*I, CI)));
100100
}
101-
else if (auto CK = dyn_cast<const comments::ParamCommandComment>(C))
101+
else if (const auto* CK = dyn_cast<const comments::ParamCommandComment>(C))
102102
{
103-
auto PC = new ParamCommandComment();
103+
auto* PC = new ParamCommandComment();
104104
_Comment = PC;
105105
HandleBlockCommand(CK, PC);
106106
if (CK->isParamIndexValid() && !CK->isVarArgParam())
107107
PC->paramIndex = CK->getParamIndex();
108108
PC->paragraphComment = static_cast<ParagraphComment*>(ConvertCommentBlock(CK->getParagraph(), CI));
109109
}
110-
else if (auto CK = dyn_cast<const comments::TParamCommandComment>(C))
110+
else if (const auto* CK = dyn_cast<const comments::TParamCommandComment>(C))
111111
{
112-
auto TC = new TParamCommandComment();
112+
auto* TC = new TParamCommandComment();
113113
_Comment = TC;
114114
HandleBlockCommand(CK, TC);
115115
if (CK->isPositionValid())
116116
for (unsigned I = 0, E = CK->getDepth(); I != E; ++I)
117117
TC->Position.push_back(CK->getIndex(I));
118118
TC->paragraphComment = static_cast<ParagraphComment*>(ConvertCommentBlock(CK->getParagraph(), CI));
119119
}
120-
else if (auto CK = dyn_cast<const comments::VerbatimBlockComment>(C))
120+
else if (const auto* CK = dyn_cast<const comments::VerbatimBlockComment>(C))
121121
{
122-
auto VB = new VerbatimBlockComment();
122+
auto* VB = new VerbatimBlockComment();
123123
_Comment = VB;
124124
for (auto I = CK->child_begin(), E = CK->child_end(); I != E; ++I)
125125
VB->Lines.push_back(static_cast<VerbatimBlockLineComment*>(ConvertCommentBlock(*I, CI)));
126126
}
127-
else if (auto CK = dyn_cast<const comments::VerbatimLineComment>(C))
127+
else if (const auto* CK = dyn_cast<const comments::VerbatimLineComment>(C))
128128
{
129-
auto VL = new VerbatimLineComment();
129+
auto* VL = new VerbatimLineComment();
130130
_Comment = VL;
131131
VL->text = CK->getText().str();
132132
}
133-
else if (auto CK = dyn_cast<const comments::BlockCommandComment>(C))
133+
else if (const auto* CK = dyn_cast<const comments::BlockCommandComment>(C))
134134
{
135-
auto BC = new BlockCommandComment();
135+
auto* BC = new BlockCommandComment();
136136
_Comment = BC;
137137
HandleBlockCommand(CK, BC);
138138
BC->paragraphComment = static_cast<ParagraphComment*>(ConvertCommentBlock(CK->getParagraph(), CI));
139139
}
140-
else if (auto CK = dyn_cast<const comments::ParagraphComment>(C))
140+
else if (const auto* CK = dyn_cast<const comments::ParagraphComment>(C))
141141
{
142-
auto PC = new ParagraphComment();
142+
auto* PC = new ParagraphComment();
143143
_Comment = PC;
144144
for (auto I = CK->child_begin(), E = CK->child_end(); I != E; ++I)
145145
PC->Content.push_back(static_cast<InlineContentComment*>(ConvertCommentBlock(*I, CI)));
146146
PC->isWhitespace = CK->isWhitespace();
147147
}
148-
else if (auto CK = dyn_cast<const comments::HTMLStartTagComment>(C))
148+
else if (const auto* CK = dyn_cast<const comments::HTMLStartTagComment>(C))
149149
{
150-
auto TC = new HTMLStartTagComment();
150+
auto* TC = new HTMLStartTagComment();
151151
_Comment = TC;
152152
HandleInlineContent(CK, TC);
153153
TC->tagName = CK->getTagName().str();
@@ -160,23 +160,23 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C, clang::Compiler
160160
TC->Attributes.push_back(Attr);
161161
}
162162
}
163-
else if (auto CK = dyn_cast<const comments::HTMLEndTagComment>(C))
163+
else if (const auto* CK = dyn_cast<const comments::HTMLEndTagComment>(C))
164164
{
165-
auto TC = new HTMLEndTagComment();
165+
auto* TC = new HTMLEndTagComment();
166166
_Comment = TC;
167167
HandleInlineContent(CK, TC);
168168
TC->tagName = CK->getTagName().str();
169169
}
170-
else if (auto CK = dyn_cast<const comments::TextComment>(C))
170+
else if (const auto* CK = dyn_cast<const comments::TextComment>(C))
171171
{
172-
auto TC = new TextComment();
172+
auto* TC = new TextComment();
173173
_Comment = TC;
174174
HandleInlineContent(CK, TC);
175175
TC->text = CK->getText().str();
176176
}
177-
else if (auto CK = dyn_cast<const comments::InlineCommandComment>(C))
177+
else if (const auto* CK = dyn_cast<const comments::InlineCommandComment>(C))
178178
{
179-
auto IC = new InlineCommandComment();
179+
auto* IC = new InlineCommandComment();
180180
_Comment = IC;
181181
HandleInlineContent(CK, IC);
182182
IC->commandId = CK->getCommandID();
@@ -189,9 +189,9 @@ static Comment* ConvertCommentBlock(clang::comments::Comment* C, clang::Compiler
189189
IC->Arguments.push_back(Arg);
190190
}
191191
}
192-
else if (auto CK = dyn_cast<const comments::VerbatimBlockLineComment>(C))
192+
else if (const auto* CK = dyn_cast<const comments::VerbatimBlockLineComment>(C))
193193
{
194-
auto VL = new VerbatimBlockLineComment();
194+
auto* VL = new VerbatimBlockLineComment();
195195
_Comment = VL;
196196
VL->text = CK->getText().str();
197197
}

0 commit comments

Comments
 (0)