[clang] New indent pp directives before hash with code (PR #186686)
Guy Turcotte via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 15 12:46:41 PDT 2026
https://github.com/turgu1 updated https://github.com/llvm/llvm-project/pull/186686
>From c25fdac05571a44bb9c7e7ec297f7d50afe549c6 Mon Sep 17 00:00:00 2001
From: Guy Turcotte <turgu666 at gmail.com>
Date: Sat, 14 Mar 2026 21:07:36 -0400
Subject: [PATCH 1/5] A new IndentPPDirectives style: BeforeHashWithCode
---
clang/include/clang/Format/Format.h | 13 ++++
clang/lib/Format/Format.cpp | 1 +
clang/lib/Format/FormatTokenSource.h | 5 +-
clang/lib/Format/UnwrappedLineFormatter.cpp | 13 +++-
clang/lib/Format/UnwrappedLineFormatter.h | 3 +-
clang/lib/Format/UnwrappedLineParser.cpp | 68 +++++++++++++++++----
6 files changed, 86 insertions(+), 17 deletions(-)
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index aea18a836328f..cb25b3a82cd5c 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3247,6 +3247,19 @@ struct FormatStyle {
/// #endif
/// \endcode
PPDIS_BeforeHash,
+ /// Indents directives before the hash with the current code indentation
+ /// level.
+ /// \code
+ /// if (foo)
+ /// {
+ /// #if FOO
+ /// #if BAR
+ /// #include <foo>
+ /// #endif
+ /// #endif
+ /// }
+ /// \endcode
+ PPDIS_BeforeHashWithCode,
/// Leaves indentation of directives as-is.
/// \note
/// Ignores ``PPIndentWidth``.
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index b98a9086811cd..563c9ba03adf2 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -622,6 +622,7 @@ struct ScalarEnumerationTraits<FormatStyle::PPDirectiveIndentStyle> {
IO.enumCase(Value, "None", FormatStyle::PPDIS_None);
IO.enumCase(Value, "AfterHash", FormatStyle::PPDIS_AfterHash);
IO.enumCase(Value, "BeforeHash", FormatStyle::PPDIS_BeforeHash);
+ IO.enumCase(Value, "BeforeHashWithCode", FormatStyle::PPDIS_BeforeHashWithCode);
IO.enumCase(Value, "Leave", FormatStyle::PPDIS_Leave);
}
};
diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h
index 8f00e5f4582c6..7ab49542ef099 100644
--- a/clang/lib/Format/FormatTokenSource.h
+++ b/clang/lib/Format/FormatTokenSource.h
@@ -191,14 +191,15 @@ class IndexedTokenSource : public FormatTokenSource {
class ScopedMacroState : public FormatTokenSource {
public:
ScopedMacroState(UnwrappedLine &Line, FormatTokenSource *&TokenSource,
- FormatToken *&ResetToken)
+ FormatToken *&ResetToken, bool PreserveLevel = false)
: Line(Line), TokenSource(TokenSource), ResetToken(ResetToken),
PreviousLineLevel(Line.Level), PreviousTokenSource(TokenSource),
Token(nullptr), PreviousToken(nullptr) {
FakeEOF.Tok.startToken();
FakeEOF.Tok.setKind(tok::eof);
TokenSource = this;
- Line.Level = 0;
+ if (!PreserveLevel)
+ Line.Level = 0;
Line.InPPDirective = true;
// InMacroBody gets set after the `#define x` part.
}
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 74c0f4bf75721..f3b1510e3f687 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -68,6 +68,12 @@ class LevelIndentTracker {
? (Line.Level - Line.PPLevel) * Style.IndentWidth +
AdditionalIndent
: Line.First->OriginalColumn;
+ } else if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode &&
+ Line.InPPDirective && !Line.InMacroBody) {
+ // For BeforeHashWithCode, PP directives are indented at the surrounding
+ // code level, using the same indentation as regular code (not PPIndentWidth).
+ Indent = getIndent(Line.Level);
+ Indent += AdditionalIndent;
} else if (Style.IndentPPDirectives != FormatStyle::PPDIS_None &&
(Line.InPPDirective ||
(Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash &&
@@ -1467,7 +1473,8 @@ unsigned UnwrappedLineFormatter::format(
if (!DryRun) {
bool LastLine = TheLine.First->is(tok::eof);
formatFirstToken(TheLine, PreviousLine, PrevPrevLine, Lines, Indent,
- LastLine ? LastStartColumn : NextStartColumn + Indent);
+ LastLine ? LastStartColumn : NextStartColumn + Indent,
+ 0);
}
NextLine = Joiner.getNextMergedLine(DryRun, IndentTracker);
@@ -1516,7 +1523,7 @@ unsigned UnwrappedLineFormatter::format(
if (ReformatLeadingWhitespace) {
formatFirstToken(TheLine, PreviousLine, PrevPrevLine, Lines,
TheLine.First->OriginalColumn,
- TheLine.First->OriginalColumn);
+ TheLine.First->OriginalColumn, 0);
} else {
Whitespaces->addUntouchableToken(*TheLine.First,
TheLine.InPPDirective);
@@ -1649,7 +1656,7 @@ void UnwrappedLineFormatter::formatFirstToken(
const AnnotatedLine &Line, const AnnotatedLine *PreviousLine,
const AnnotatedLine *PrevPrevLine,
const SmallVectorImpl<AnnotatedLine *> &Lines, unsigned Indent,
- unsigned NewlineIndent) {
+ unsigned NewlineIndent, unsigned PPNestingLevel) {
FormatToken &RootToken = *Line.First;
if (RootToken.is(tok::eof)) {
unsigned Newlines = std::min(
diff --git a/clang/lib/Format/UnwrappedLineFormatter.h b/clang/lib/Format/UnwrappedLineFormatter.h
index 9b8acf427a2a0..17889d03644b6 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.h
+++ b/clang/lib/Format/UnwrappedLineFormatter.h
@@ -47,7 +47,8 @@ class UnwrappedLineFormatter {
const AnnotatedLine *PreviousLine,
const AnnotatedLine *PrevPrevLine,
const SmallVectorImpl<AnnotatedLine *> &Lines,
- unsigned Indent, unsigned NewlineIndent);
+ unsigned Indent, unsigned NewlineIndent,
+ unsigned PPNestingLevel = 0);
/// Returns the column limit for a line, taking into account whether we
/// need an escaped newline due to a continued preprocessor directive.
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index ddf584c6ed818..c3ad21cf5291e 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -998,7 +998,12 @@ void UnwrappedLineParser::parseChildBlock() {
void UnwrappedLineParser::parsePPDirective() {
assert(FormatTok->is(tok::hash) && "'#' expected");
- ScopedMacroState MacroState(*Line, Tokens, FormatTok);
+ // For BeforeHashWithCode, PP directives are indented at the surrounding code
+ // level. Preserving Line->Level allows ScopedMacroState to keep the code
+ // context level instead of resetting it to 0.
+ const bool PreserveLevel =
+ Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode;
+ ScopedMacroState MacroState(*Line, Tokens, FormatTok, PreserveLevel);
nextToken();
@@ -4639,7 +4644,27 @@ void UnwrappedLineParser::addUnwrappedLine(LineLevel AdjustLevel) {
// At the top level we only get here when no unexpansion is going on, or
// when conditional formatting led to unfinished macro reconstructions.
assert(!Reconstruct || (CurrentLines != &Lines) || !PPStack.empty());
+ // For BeforeHashWithCode, code lines inside PP conditional blocks must be
+ // indented by the PP nesting depth so that code appears more indented than
+ // its enclosing PP directive (mirroring how C++ block content is indented
+ // relative to the opening brace). PP directive lines already have
+ // PPBranchLevel+1 added in parsePPUnknown; code lines need the same
+ // treatment. We temporarily adjust Level here and restore it afterwards so
+ // that the next line still starts from the correct C++ brace level.
+ // For BeforeHashWithCode, code lines inside PP blocks need their level
+ // raised to match the enclosing PP directive's nesting depth. Using
+ // Line->PPLevel (set at first-token push time) instead of the current
+ // PPBranchLevel, which may have been altered by later PP directives that
+ // readToken processed after the code tokens but before addUnwrappedLine.
+ const bool BWHCCodeLine =
+ Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode &&
+ !Line->InPPDirective && Line->PPLevel > 0;
+ const unsigned PPAdj = BWHCCodeLine ? Line->PPLevel : 0;
+ if (BWHCCodeLine)
+ Line->Level += PPAdj;
CurrentLines->push_back(std::move(*Line));
+ if (BWHCCodeLine)
+ Line->Level -= PPAdj;
}
Line->Tokens.clear();
Line->MatchingOpeningBlockLineIndex = UnwrappedLine::kInvalidIndex;
@@ -4926,16 +4951,28 @@ void UnwrappedLineParser::readToken(int LevelDifference) {
// directives only after that unwrapped line was finished later.
bool SwitchToPreprocessorLines = !Line->Tokens.empty();
ScopedLineState BlockState(*this, SwitchToPreprocessorLines);
- assert((LevelDifference >= 0 ||
- static_cast<unsigned>(-LevelDifference) <= Line->Level) &&
- "LevelDifference makes Line->Level negative");
- Line->Level += LevelDifference;
- // Comments stored before the preprocessor directive need to be output
- // before the preprocessor directive, at the same level as the
- // preprocessor directive, as we consider them to apply to the directive.
- if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash &&
- PPBranchLevel > 0) {
- Line->Level += PPBranchLevel;
+ // For BeforeHashWithCode, the PP directive is indented at the surrounding
+ // code level. Apply LevelDifference to get the correct code context level
+ // (e.g. leaving a block), but do NOT apply PPBranchLevel since PP
+ // directives should align with the code rather than nesting PP levels.
+ if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode) {
+ assert((LevelDifference >= 0 ||
+ static_cast<unsigned>(-LevelDifference) <= Line->Level) &&
+ "LevelDifference makes Line->Level negative");
+ Line->Level += LevelDifference;
+ } else {
+ assert((LevelDifference >= 0 ||
+ static_cast<unsigned>(-LevelDifference) <= Line->Level) &&
+ "LevelDifference makes Line->Level negative");
+ Line->Level += LevelDifference;
+ // Comments stored before the preprocessor directive need to be output
+ // before the preprocessor directive, at the same level as the
+ // preprocessor directive, as we consider them to apply to the
+ // directive.
+ if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash &&
+ PPBranchLevel > 0) {
+ Line->Level += PPBranchLevel;
+ }
}
assert(Line->Level >= Line->UnbracedBodyLevel);
Line->Level -= Line->UnbracedBodyLevel;
@@ -5111,6 +5148,15 @@ UnwrappedLineParser::parseMacroCall() {
}
void UnwrappedLineParser::pushToken(FormatToken *Tok) {
+ // For BeforeHashWithCode style, record the actual PP nesting depth when the
+ // first token of a code (non-PP) line is pushed. This captures the true PP
+ // context at line-start time, before readToken may subsequently process
+ // more PP directives and change PPBranchLevel before addUnwrappedLine.
+ if (Line->Tokens.empty() && !Line->InPPDirective &&
+ Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode) {
+ Line->PPLevel =
+ PPBranchLevel >= 0 ? static_cast<unsigned>(PPBranchLevel + 1) : 0;
+ }
Line->Tokens.push_back(UnwrappedLineNode(Tok));
if (AtEndOfPPLine) {
auto &Tok = *Line->Tokens.back().Tok;
>From 43a5fe4b85a2c30096722ea92d683fa75df54b2f Mon Sep 17 00:00:00 2001
From: Guy Turcotte <turgu666 at gmail.com>
Date: Sun, 15 Mar 2026 13:23:36 -0400
Subject: [PATCH 2/5] Some correction
---
clang/lib/Format/UnwrappedLineFormatter.cpp | 6 +-
clang/lib/Format/UnwrappedLineParser.cpp | 67 ++++++++++++++++++++-
2 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index f3b1510e3f687..ad55a9ee678ea 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -68,10 +68,12 @@ class LevelIndentTracker {
? (Line.Level - Line.PPLevel) * Style.IndentWidth +
AdditionalIndent
: Line.First->OriginalColumn;
- } else if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode &&
+ } else if (Style.IndentPPDirectives ==
+ FormatStyle::PPDIS_BeforeHashWithCode &&
Line.InPPDirective && !Line.InMacroBody) {
// For BeforeHashWithCode, PP directives are indented at the surrounding
- // code level, using the same indentation as regular code (not PPIndentWidth).
+ // code level, using the same indentation as regular code (not
+ // PPIndentWidth).
Indent = getIndent(Line.Level);
Indent += AdditionalIndent;
} else if (Style.IndentPPDirectives != FormatStyle::PPDIS_None &&
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index c3ad21cf5291e..34aa92b31f79b 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -1237,6 +1237,18 @@ void UnwrappedLineParser::parsePPUnknown() {
nextToken();
if (Style.IndentPPDirectives != FormatStyle::PPDIS_None)
Line->Level += PPBranchLevel + 1;
+ // For BeforeHashWithCode, PP directives inside unreachable branches must
+ // not be emitted: in multi-pass formatting the surrounding C++ braces may
+ // have been skipped (PP_Unreachable code is not parsed), leaving
+ // Line->Level too low. The resulting incorrect replacement would conflict
+ // with the correct one produced by the reachable pass, causing an
+ // "overlapping replacement" error and an empty output. Simply discard the
+ // accumulated tokens so the reachable pass wins.
+ if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode &&
+ !PPStack.empty() && PPStack.back().Kind == PP_Unreachable) {
+ Line->Tokens.clear();
+ return;
+ }
addUnwrappedLine();
}
@@ -2524,11 +2536,30 @@ bool UnwrappedLineParser::parseBracedList(bool IsAngleBracket, bool IsEnum) {
parseChildBlock();
}
}
+ // For BeforeHashWithCode enum bodies: whenever readToken just processed a
+ // PP directive and returned the first post-PP token (AtEndOfPPLine=true),
+ // flush the accumulated pre-PP body tokens as their own UnwrappedLine.
+ // This gives each PP-separated segment its own line so the BWHCCodeLine
+ // level-boost in addUnwrappedLine can apply the correct indentation.
+ if (IsEnum && !IsAngleBracket &&
+ Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode &&
+ Style.AllowShortEnumsOnASingleLine && AtEndOfPPLine &&
+ !Line->Tokens.empty()) {
+ addUnwrappedLine();
+ }
if (FormatTok->is(IsAngleBracket ? tok::greater : tok::r_brace)) {
if (IsEnum) {
FormatTok->setBlockKind(BK_Block);
- if (!Style.AllowShortEnumsOnASingleLine)
+ if (!Style.AllowShortEnumsOnASingleLine) {
+ addUnwrappedLine();
+ } else if (Style.IndentPPDirectives ==
+ FormatStyle::PPDIS_BeforeHashWithCode &&
+ !Line->Tokens.empty()) {
+ // For BeforeHashWithCode, flush any remaining enum body tokens
+ // before the closing brace so they get their own UnwrappedLine
+ // with the correct indentation level.
addUnwrappedLine();
+ }
}
nextToken();
return !HasError;
@@ -3885,10 +3916,20 @@ bool UnwrappedLineParser::parseEnum() {
if (!Style.AllowShortEnumsOnASingleLine) {
addUnwrappedLine();
Line->Level += 1;
+ } else if (Style.IndentPPDirectives ==
+ FormatStyle::PPDIS_BeforeHashWithCode) {
+ // For BeforeHashWithCode, flush the enum declaration as its own
+ // UnwrappedLine (like AllowShortEnumsOnASingleLine=false does) so that
+ // body tokens start in a fresh line. Each PP-separated segment of the
+ // body can then be emitted at its correct indentation via BWHCCodeLine.
+ addUnwrappedLine();
+ ++Line->Level;
}
bool HasError = !parseBracedList(/*IsAngleBracket=*/false, /*IsEnum=*/true);
if (!Style.AllowShortEnumsOnASingleLine)
Line->Level -= 1;
+ else if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHashWithCode)
+ --Line->Level;
if (HasError) {
if (FormatTok->is(tok::semi))
nextToken();
@@ -4950,6 +4991,9 @@ void UnwrappedLineParser::readToken(int LevelDifference) {
// If there is an unfinished unwrapped line, we flush the preprocessor
// directives only after that unwrapped line was finished later.
bool SwitchToPreprocessorLines = !Line->Tokens.empty();
+ // Save CurrentLines before ScopedLineState may switch it to
+ // PreprocessorDirectives, so we can detect child-block contexts later.
+ const auto *OrigCurrentLines = CurrentLines;
ScopedLineState BlockState(*this, SwitchToPreprocessorLines);
// For BeforeHashWithCode, the PP directive is indented at the surrounding
// code level. Apply LevelDifference to get the correct code context level
@@ -4960,16 +5004,33 @@ void UnwrappedLineParser::readToken(int LevelDifference) {
static_cast<unsigned>(-LevelDifference) <= Line->Level) &&
"LevelDifference makes Line->Level negative");
Line->Level += LevelDifference;
+ // When this PP directive is being deferred to PreprocessorDirectives
+ // (SwitchToPreprocessorLines=true), it may be encountered at a deeper
+ // C++ brace nesting than the opening PP directive of the same
+ // conditional block. This happens inside child-block contexts (e.g.
+ // lambda bodies): the opening #if is processed by readToken() before
+ // parseChildBlock()'s ScopedLineState adds +1 to Line->Level, while
+ // the closing #endif is processed after, giving it a Level one higher
+ // than the #if. Detect child-block context by checking OrigCurrentLines
+ // (saved before ScopedLineState may switch CurrentLines): inside a
+ // child block it points to the parent's token children list rather than
+ // the top-level Lines vector. Use the level recorded for the first
+ // deferred directive (the opening #if) so that all directives of the
+ // same conditional block share the same C++ level.
+ if (SwitchToPreprocessorLines && !PreprocessorDirectives.empty() &&
+ OrigCurrentLines != &Lines) {
+ Line->Level = PreprocessorDirectives.front().Level;
+ }
} else {
assert((LevelDifference >= 0 ||
static_cast<unsigned>(-LevelDifference) <= Line->Level) &&
- "LevelDifference makes Line->Level negative");
+ "LevelDifference makes Line->Level negative");
Line->Level += LevelDifference;
// Comments stored before the preprocessor directive need to be output
// before the preprocessor directive, at the same level as the
// preprocessor directive, as we consider them to apply to the
// directive.
- if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash &&
+ if (Style.IndentPPDirectives == FormatStyle::PPDIS_BeforeHash &&
PPBranchLevel > 0) {
Line->Level += PPBranchLevel;
}
>From 637767a97641209727b19cca8d6affc1585e96f5 Mon Sep 17 00:00:00 2001
From: Guy Turcotte <turgu666 at gmail.com>
Date: Sun, 15 Mar 2026 15:38:42 -0400
Subject: [PATCH 3/5] Corrected line formatting.
---
clang/lib/Format/Format.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 8dedab081a55c..787b469f9ccd5 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -622,7 +622,8 @@ struct ScalarEnumerationTraits<FormatStyle::PPDirectiveIndentStyle> {
IO.enumCase(Value, "None", FormatStyle::PPDIS_None);
IO.enumCase(Value, "AfterHash", FormatStyle::PPDIS_AfterHash);
IO.enumCase(Value, "BeforeHash", FormatStyle::PPDIS_BeforeHash);
- IO.enumCase(Value, "BeforeHashWithCode", FormatStyle::PPDIS_BeforeHashWithCode);
+ IO.enumCase(Value, "BeforeHashWithCode",
+ FormatStyle::PPDIS_BeforeHashWithCode);
IO.enumCase(Value, "Leave", FormatStyle::PPDIS_Leave);
}
};
>From 0615fd3b7e1ab7cf098b411b64618da5698aa05c Mon Sep 17 00:00:00 2001
From: Guy Turcotte <turgu666 at gmail.com>
Date: Sun, 15 Mar 2026 15:46:10 -0400
Subject: [PATCH 4/5] Update clang/lib/Format/UnwrappedLineFormatter.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Björn Schäpers <github at hazardy.de>
---
clang/lib/Format/UnwrappedLineFormatter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index e282b0e27da07..15255e0b06d96 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1565,7 +1565,7 @@ unsigned UnwrappedLineFormatter::format(
bool LastLine = TheLine.First->is(tok::eof);
formatFirstToken(TheLine, PreviousLine, PrevPrevLine, Lines, Indent,
LastLine ? LastStartColumn : NextStartColumn + Indent,
- 0);
+ /*PPNestingLevel=*/0);
}
NextLine = Joiner.getNextMergedLine(DryRun, IndentTracker);
>From 9c2e33016a4ac8cef9e6c840dd66294a68eef04a Mon Sep 17 00:00:00 2001
From: Guy Turcotte <turgu666 at gmail.com>
Date: Sun, 15 Mar 2026 15:46:31 -0400
Subject: [PATCH 5/5] Update clang/lib/Format/UnwrappedLineParser.cpp
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Björn Schäpers <github at hazardy.de>
---
clang/lib/Format/UnwrappedLineParser.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index d4af259a54832..db886a5cbc8d0 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2543,7 +2543,7 @@ bool UnwrappedLineParser::parseBracedList(bool IsAngleBracket, bool IsEnum) {
}
}
// For BeforeHashWithCode enum bodies: whenever readToken just processed a
- // PP directive and returned the first post-PP token (AtEndOfPPLine=true),
+ // PP directive and returned the first post-PP token (AtEndOfPPLine == true),
// flush the accumulated pre-PP body tokens as their own UnwrappedLine.
// This gives each PP-separated segment its own line so the BWHCCodeLine
// level-boost in addUnwrappedLine can apply the correct indentation.
More information about the cfe-commits
mailing list