26 bool SomeLineAffected =
false;
37 while (PPEnd != E && !(*PPEnd)->First->HasUnescapedNewline) {
38 Last = (*PPEnd)->Last;
42 if (affectsTokenRange(*Line->
First, *Last,
44 SomeLineAffected =
true;
45 markAllAsAffected(I, PPEnd);
51 if (nonPPLineAffected(Line, PreviousLine, Lines))
52 SomeLineAffected =
true;
57 return SomeLineAffected;
74 bool IncludeLeadingNewlines) {
76 if (!IncludeLeadingNewlines)
84 bool AffectedRangeManager::affectsLeadingEmptyLines(
const FormatToken &
Tok) {
91 void AffectedRangeManager::markAllAsAffected(
95 (*I)->Affected =
true;
96 markAllAsAffected((*I)->Children.begin(), (*I)->Children.end());
101 bool AffectedRangeManager::nonPPLineAffected(
104 bool SomeLineAffected =
false;
107 SomeLineAffected =
true;
110 bool SomeTokenAffected =
false;
113 bool IncludeLeadingNewlines =
false;
117 bool SomeFirstChildAffected =
false;
121 if (affectsTokenRange(*Tok, *Tok, IncludeLeadingNewlines))
122 SomeTokenAffected =
true;
126 SomeFirstChildAffected =
true;
128 IncludeLeadingNewlines = Tok->
Children.empty();
133 bool LineMoved = PreviousLine && PreviousLine->
Affected &&
136 bool IsContinuedComment =
141 bool IsAffectedClosingBrace =
142 Line->
First->
is(tok::r_brace) &&
146 if (SomeTokenAffected || SomeFirstChildAffected || LineMoved ||
147 IsContinuedComment || IsAffectedClosingBrace) {
149 SomeLineAffected =
true;
151 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