@@ -207,11 +207,13 @@ void Prescanner::Statement() {
207
207
toks.Put (id, GetProvenance (at_));
208
208
if (auto replaced{preprocessor_.MacroReplacement (toks, *this )}) {
209
209
auto newLineClass{ClassifyLine (*replaced, GetCurrentProvenance ())};
210
- disableSourceContinuation_ =
211
- newLineClass.kind != LineClassification::Kind::Source;
212
210
if (newLineClass.kind ==
213
211
LineClassification::Kind::CompilerDirective) {
214
212
directiveSentinel_ = newLineClass.sentinel ;
213
+ disableSourceContinuation_ = false ;
214
+ } else {
215
+ disableSourceContinuation_ =
216
+ newLineClass.kind != LineClassification::Kind::Source;
215
217
}
216
218
}
217
219
}
@@ -1114,39 +1116,33 @@ bool Prescanner::SkipCommentLine(bool afterAmpersand) {
1114
1116
SkipToEndOfLine ();
1115
1117
omitNewline_ = true ;
1116
1118
}
1117
- return false ;
1118
- }
1119
- auto lineClass{ClassifyLine (nextLine_)};
1120
- if (lineClass.kind == LineClassification::Kind::Comment) {
1121
- NextLine ();
1122
- return true ;
1123
1119
} else if (inPreprocessorDirective_) {
1124
- return false ;
1125
- } else if (afterAmpersand &&
1126
- (lineClass.kind ==
1127
- LineClassification::Kind::ConditionalCompilationDirective ||
1128
- lineClass.kind == LineClassification::Kind::DefinitionDirective ||
1129
- lineClass.kind == LineClassification::Kind::PreprocessorDirective ||
1130
- lineClass.kind == LineClassification::Kind::IncludeDirective ||
1131
- lineClass.kind == LineClassification::Kind::IncludeLine)) {
1132
- SkipToEndOfLine ();
1133
- omitNewline_ = true ;
1134
- skipLeadingAmpersand_ = true ;
1135
- return false ;
1136
- } else if (lineClass.kind ==
1137
- LineClassification::Kind::ConditionalCompilationDirective ||
1138
- lineClass.kind == LineClassification::Kind::PreprocessorDirective) {
1139
- // Allow conditional compilation directives (e.g., #ifdef) to affect
1140
- // continuation lines.
1141
- // Allow other preprocessor directives, too, except #include
1142
- // (when it does not follow '&'), #define, and #undef (because
1143
- // they cannot be allowed to affect preceding text on a
1144
- // continued line).
1145
- preprocessor_.Directive (TokenizePreprocessorDirective (), *this );
1146
- return true ;
1147
1120
} else {
1148
- return false ;
1121
+ auto lineClass{ClassifyLine (nextLine_)};
1122
+ if (lineClass.kind == LineClassification::Kind::Comment) {
1123
+ NextLine ();
1124
+ return true ;
1125
+ } else if (lineClass.kind ==
1126
+ LineClassification::Kind::ConditionalCompilationDirective ||
1127
+ lineClass.kind == LineClassification::Kind::PreprocessorDirective) {
1128
+ // Allow conditional compilation directives (e.g., #ifdef) to affect
1129
+ // continuation lines.
1130
+ // Allow other preprocessor directives, too, except #include
1131
+ // (when it does not follow '&'), #define, and #undef (because
1132
+ // they cannot be allowed to affect preceding text on a
1133
+ // continued line).
1134
+ preprocessor_.Directive (TokenizePreprocessorDirective (), *this );
1135
+ return true ;
1136
+ } else if (afterAmpersand &&
1137
+ (lineClass.kind == LineClassification::Kind::DefinitionDirective ||
1138
+ lineClass.kind == LineClassification::Kind::IncludeDirective ||
1139
+ lineClass.kind == LineClassification::Kind::IncludeLine)) {
1140
+ SkipToEndOfLine ();
1141
+ omitNewline_ = true ;
1142
+ skipLeadingAmpersand_ = true ;
1143
+ }
1149
1144
}
1145
+ return false ;
1150
1146
}
1151
1147
1152
1148
const char *Prescanner::FixedFormContinuationLine (bool mightNeedSpace) {
0 commit comments