aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-03-19 18:02:09 -0700
committerOwen Pan <owenpiano@gmail.com>2024-03-19 18:06:59 -0700
commit6f31cf51dfdc2c317ba8149d57d2ffb583403833 (patch)
treec8e573cc76f641371b41c4301577a9bbaba6770d /clang/lib/Format/ContinuationIndenter.cpp
parenta289f66efd638c2af14cdb88968e4eaeea0c0605 (diff)
downloadllvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.zip
llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.tar.gz
llvm-6f31cf51dfdc2c317ba8149d57d2ffb583403833.tar.bz2
Revert "[clang-format][NFC] Eliminate the IsCpp parameter in all functions (#84599)"
This reverts c3a1eb6207d8 (and the related commit f3c5278efa3b) which makes cleanupAroundReplacements() no longer thread-safe.
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index b3de317f..6ccc819 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -232,9 +232,7 @@ ContinuationIndenter::ContinuationIndenter(const FormatStyle &Style,
: Style(Style), Keywords(Keywords), SourceMgr(SourceMgr),
Whitespaces(Whitespaces), Encoding(Encoding),
BinPackInconclusiveFunctions(BinPackInconclusiveFunctions),
- CommentPragmasRegex(Style.CommentPragmas), RawStringFormats(Style) {
- assert(IsCpp == Style.isCpp());
-}
+ CommentPragmasRegex(Style.CommentPragmas), RawStringFormats(Style) {}
LineState ContinuationIndenter::getInitialState(unsigned FirstIndent,
unsigned FirstStartColumn,
@@ -399,7 +397,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
}
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
(Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) &&
- State.Line->First->isNot(TT_AttributeSquare) && IsCpp &&
+ State.Line->First->isNot(TT_AttributeSquare) && Style.isCpp() &&
// FIXME: This is a temporary workaround for the case where clang-format
// sets BreakBeforeParameter to avoid bin packing and this creates a
// completely unnecessary line break after a template type that isn't
@@ -670,8 +668,8 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
auto &CurrentState = State.Stack.back();
bool DisallowLineBreaksOnThisLine =
- Style.LambdaBodyIndentation == FormatStyle::LBI_Signature && IsCpp &&
- [&Current] {
+ Style.LambdaBodyIndentation == FormatStyle::LBI_Signature &&
+ Style.isCpp() && [&Current] {
// Deal with lambda arguments in C++. The aim here is to ensure that we
// don't over-indent lambda function bodies when lambdas are passed as
// arguments to function calls. We do this by ensuring that either all
@@ -1085,7 +1083,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
// Any break on this level means that the parent level has been broken
// and we need to avoid bin packing there.
bool NestedBlockSpecialCase =
- (!IsCpp && Current.is(tok::r_brace) && State.Stack.size() > 1 &&
+ (!Style.isCpp() && Current.is(tok::r_brace) && State.Stack.size() > 1 &&
State.Stack[State.Stack.size() - 2].NestedBlockInlined) ||
(Style.Language == FormatStyle::LK_ObjC && Current.is(tok::r_brace) &&
State.Stack.size() > 1 && !Style.ObjCBreakBeforeNestedBlockParam);