File tree 3 files changed +12
-8
lines changed
3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ void Prescanner::Statement() {
193
193
NormalizeCompilerDirectiveCommentMarker (*preprocessed);
194
194
preprocessed->ToLowerCase ();
195
195
SourceFormChange (preprocessed->ToString ());
196
- preprocessed->ClipComment ().Emit (cooked_);
196
+ preprocessed->ClipComment (true /* skip first ! */ ).Emit (cooked_);
197
197
break ;
198
198
case LineClassification::Kind::Source:
199
199
if (inFixedForm_) {
Original file line number Diff line number Diff line change @@ -221,16 +221,20 @@ TokenSequence &TokenSequence::RemoveRedundantBlanks(std::size_t firstChar) {
221
221
return *this ;
222
222
}
223
223
224
- TokenSequence &TokenSequence::ClipComment () {
224
+ TokenSequence &TokenSequence::ClipComment (bool skipFirst ) {
225
225
std::size_t tokens{SizeInTokens ()};
226
226
for (std::size_t j{0 }; j < tokens; ++j) {
227
227
if (TokenAt (j).FirstNonBlank () == ' !' ) {
228
- TokenSequence result;
229
- if (j > 0 ) {
230
- result.Put (*this , 0 , j - 1 );
228
+ if (skipFirst) {
229
+ skipFirst = false ;
230
+ } else {
231
+ TokenSequence result;
232
+ if (j > 0 ) {
233
+ result.Put (*this , 0 , j - 1 );
234
+ }
235
+ swap (result);
236
+ return *this ;
231
237
}
232
- swap (result);
233
- return *this ;
234
238
}
235
239
}
236
240
return *this ;
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ class TokenSequence {
108
108
bool HasRedundantBlanks (std::size_t firstChar = 0 ) const ;
109
109
TokenSequence &RemoveBlanks (std::size_t firstChar = 0 );
110
110
TokenSequence &RemoveRedundantBlanks (std::size_t firstChar = 0 );
111
- TokenSequence &ClipComment ();
111
+ TokenSequence &ClipComment (bool skipFirst = false );
112
112
void Emit (CookedSource &) const ;
113
113
void Dump (std::ostream &) const ;
114
114
You can’t perform that action at this time.
0 commit comments