27 bool SomeLineAffected =
false;
38 while (PPEnd != E && !(*PPEnd)->First->HasUnescapedNewline) {
39 Last = (*PPEnd)->Last;
43 if (affectsTokenRange(*Line->
First, *Last,
45 SomeLineAffected =
true;
46 markAllAsAffected(I, PPEnd);
52 if (nonPPLineAffected(Line, PreviousLine, Lines))
53 SomeLineAffected =
true;
58 return SomeLineAffected;
75 bool IncludeLeadingNewlines) {
77 if (!IncludeLeadingNewlines)
85 bool AffectedRangeManager::affectsLeadingEmptyLines(
const FormatToken &
Tok) {
92 void AffectedRangeManager::markAllAsAffected(
96 (*I)->Affected =
true;
97 markAllAsAffected((*I)->Children.begin(), (*I)->Children.end());
102 bool AffectedRangeManager::nonPPLineAffected(
105 bool SomeLineAffected =
false;
108 SomeLineAffected =
true;
111 bool SomeTokenAffected =
false;
114 bool IncludeLeadingNewlines =
false;
118 bool SomeFirstChildAffected =
false;
122 if (affectsTokenRange(*Tok, *Tok, IncludeLeadingNewlines))
123 SomeTokenAffected =
true;
127 SomeFirstChildAffected =
true;
129 IncludeLeadingNewlines = Tok->
Children.empty();
134 bool LineMoved = PreviousLine && PreviousLine->
Affected &&
137 bool IsContinuedComment =
142 bool IsAffectedClosingBrace =
143 Line->
First->
is(tok::r_brace) &&
147 if (SomeTokenAffected || SomeFirstChildAffected || LineMoved ||
148 IsContinuedComment || IsAffectedClosingBrace) {
150 SomeLineAffected =
true;
152 return SomeLineAffected;
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
AffectedRangeManager class manages affected ranges in the code.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
SourceLocation getBegin() const
This file implements a token annotator, i.e.
Represents a character-granular source range.
const AnnotatedLine * Line
static CharSourceRange getCharRange(SourceRange R)
Encodes a location in the source.
Dataflow Directional Tag Classes.
SourceLocation getEnd() const
SourceLocation getBegin() const