https://github.com/HazardyKnusperkeks closed
https://github.com/llvm/llvm-project/pull/145145
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/145145
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
HazardyKnusperkeks wrote:
> > You can't change existing tests, you need an option if you want to pad with
> > spaces
>
> It is unclear to me if this should be considered a bug fix, or a new feature.
> Surely requiring new options are not required for every bug fix.
>
It boils down to the que
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/144255
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -706,42 +706,48 @@ void
ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
const FormatToken &Previous = *State.NextToken->Previous;
auto &CurrentState = State.Stack.back();
- bool DisallowLineBreaksOnThisLine =
- Style.LambdaBodyIndentati
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/144095
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3651,6 +3674,21 @@ static FormatToken *getFunctionName(const AnnotatedLine
&Line,
continue;
}
+// Skip past template typename declarations that may precede the
+// constructor/destructor name
+if (Tok->is(tok::kw_template)) {
Hazardy
@@ -3659,9 +3697,23 @@ static FormatToken *getFunctionName(const AnnotatedLine
&Line,
}
// Skip to the unqualified part of the name.
-while (Tok->startsSequence(tok::identifier, tok::coloncolon)) {
- assert(Tok->Next);
- Tok = Tok->Next->Next;
+while
@@ -3651,6 +3674,21 @@ static FormatToken *getFunctionName(const AnnotatedLine
&Line,
continue;
}
+// Skip past template typename declarations that may precede the
+// constructor/destructor name
HazardyKnusperkeks wrote:
```suggestion
@@ -3622,6 +3622,29 @@ static unsigned maxNestingDepth(const AnnotatedLine
&Line) {
return Result;
}
+static bool startsQualifiedName(const FormatToken *Tok) {
+ // Consider: A::B::B()
+ // Tok --^
+ if (Tok->startsSequence(tok::identifier, tok::coloncolo
@@ -3622,6 +3622,29 @@ static unsigned maxNestingDepth(const AnnotatedLine
&Line) {
return Result;
}
+static bool startsQualifiedName(const FormatToken *Tok) {
HazardyKnusperkeks wrote:
Id check for `tok::identifier` and then move to `nextNonComment()` for
@@ -3651,6 +3674,21 @@ static FormatToken *getFunctionName(const AnnotatedLine
&Line,
continue;
}
+// Skip past template typename declarations that may precede the
+// constructor/destructor name
+if (Tok->is(tok::kw_template)) {
Hazardy
@@ -27901,39 +27901,39 @@ TEST_F(FormatTest,
AlignArrayOfStructuresLeftAlignmentNonSquare) {
// crashes, these tests assert that the array is not changed but will
// also act as regression tests for when it is properly fixed
verifyFormat("struct test demo[] = {\n"
-
@@ -22276,7 +22276,7 @@ TEST_F(FormatTest,
CatchAlignArrayOfStructuresLeftAlignment) {
verifyFormat("auto foo = Items{\n"
"Section{\n"
"0, bar(),\n"
- "}\n"
+ "}\n"
Haz
@@ -4251,7 +4251,28 @@ FormatToken
*TokenAnnotator::calculateInitializerColumnList(
CurrentToken = CurrentToken->Next;
if (!CurrentToken)
break;
- CurrentToken->StartsColumn = true;
+
+ // Right (closing) braces should not count as starting a colu
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/143477
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1547,6 +1547,38 @@ struct FormatStyle {
bool BeforeWhile;
/// Indent the wrapped braces themselves.
bool IndentBraces;
+/// Indent nested wrapped lambda braces.
HazardyKnusperkeks wrote:
Yeah I can't think of a nice name here... @owenca do
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/143327
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/143302
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks commented:
A general note, if you comment in the `Files changed` tab and `Start a review`
it should only send one email for all your comments.
https://github.com/llvm/llvm-project/pull/143249
___
cfe-commits maili
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/143249
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1547,6 +1547,38 @@ struct FormatStyle {
bool BeforeWhile;
/// Indent the wrapped braces themselves.
bool IndentBraces;
+/// Indent nested wrapped lambda braces.
HazardyKnusperkeks wrote:
I don't really have something, but you should swap La
@@ -1334,12 +1334,15 @@ unsigned ContinuationIndenter::getNewLineColumn(const
LineState &State) {
Style.IndentWidth;
}
- if (Style.BraceWrapping.BeforeLambdaBody &&
- Style.BraceWrapping.IndentBraces && Current.is(TT_LambdaLBrace)) {
+ if (Style.BraceWrapp
@@ -284,27 +284,23 @@ static bool fillRanges(MemoryBuffer *Code,
errs() << "error: number of -offset and -length arguments must match.\n";
return true;
}
- for (unsigned i = 0, e = Offsets.size(); i != e; ++i) {
-if (Offsets[i] >= Code->getBufferSize()) {
-
@@ -1334,12 +1334,15 @@ unsigned ContinuationIndenter::getNewLineColumn(const
LineState &State) {
Style.IndentWidth;
}
- if (Style.BraceWrapping.BeforeLambdaBody &&
- Style.BraceWrapping.IndentBraces && Current.is(TT_LambdaLBrace)) {
+ if (Style.BraceWrapp
@@ -1547,6 +1547,38 @@ struct FormatStyle {
bool BeforeWhile;
/// Indent the wrapped braces themselves.
bool IndentBraces;
+/// Indent nested wrapped lambda braces.
HazardyKnusperkeks wrote:
I think a better name is in order, when reading neste
@@ -1334,12 +1334,15 @@ unsigned ContinuationIndenter::getNewLineColumn(const
LineState &State) {
Style.IndentWidth;
}
- if (Style.BraceWrapping.BeforeLambdaBody &&
- Style.BraceWrapping.IndentBraces && Current.is(TT_LambdaLBrace)) {
+ if (Style.BraceWrapp
@@ -1334,12 +1334,15 @@ unsigned ContinuationIndenter::getNewLineColumn(const
LineState &State) {
Style.IndentWidth;
}
- if (Style.BraceWrapping.BeforeLambdaBody &&
- Style.BraceWrapping.IndentBraces && Current.is(TT_LambdaLBrace)) {
+ if (Style.BraceWrapp
@@ -284,27 +284,23 @@ static bool fillRanges(MemoryBuffer *Code,
errs() << "error: number of -offset and -length arguments must match.\n";
HazardyKnusperkeks wrote:
Is it maybe worth handling the `Offsets.empty() && Lengths.empty()` case by its
own, and the
@@ -284,27 +284,23 @@ static bool fillRanges(MemoryBuffer *Code,
errs() << "error: number of -offset and -length arguments must match.\n";
return true;
}
- for (unsigned i = 0, e = Offsets.size(); i != e; ++i) {
-if (Offsets[i] >= Code->getBufferSize()) {
-
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/143236
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/143083
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
For all sane code this works. Although there are valid codes where a star can
preceed a requires expression.
https://github.com/llvm/llvm-project/pull/142893
___
cfe-commits mailing lis
HazardyKnusperkeks wrote:
I'd say yes.
https://github.com/llvm/llvm-project/pull/142104
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/142337
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -3848,6 +3848,8 @@ static bool isFunctionDeclarationName(const LangOptions
&LangOpts,
} else {
if (Current.isNot(TT_StartOfName) || Current.NestingLevel != 0)
return false;
+while (Next && Next->startsSequence(tok::hashhash, tok::identifier))
---
@@ -2257,6 +2257,13 @@ TEST_F(TokenAnnotatorTest,
UnderstandsFunctionDeclarationNames) {
EXPECT_TOKEN(Tokens[1], tok::identifier, TT_FunctionDeclarationName);
EXPECT_TOKEN(Tokens[2], tok::l_paren, TT_FunctionDeclarationLParen);
+ Tokens = annotate("#define FUNC(foo, bar)
https://github.com/HazardyKnusperkeks approved this pull request.
Please wait for @owenca or @mydeveloperday.
https://github.com/llvm/llvm-project/pull/141576
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailma
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/142251
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/142104
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/141714
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -23814,6 +23814,20 @@ TEST_F(FormatTest, FormatsLambdas) {
"}",
LLVMWithBeforeLambdaBody);
+ // Make sure we don't put the lambda on a new line when it would be indented
HazardyKnusperkeks wrote:
I think you can drop the comm
@@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState
&State) {
if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder)
return false;
- // Don't create a 'hanging' indent if there are multiple blocks in a single
- // statement and we
@@ -23814,6 +23814,20 @@ TEST_F(FormatTest, FormatsLambdas) {
"}",
LLVMWithBeforeLambdaBody);
+ // Make sure we don't put the lambda on a new line when it would be indented
+ // more than where it would be otherwise.
+ verifyFormat("if ([]()\n"
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/141334
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/141334
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/141202
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/140835
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1647,7 +1647,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SeparateDefinitionBlocks = FormatStyle::SDS_Leave;
LLVMStyle.ShortNamespaceLines = 1;
LLVMStyle.SkipMacroDefinitionBody = false;
- LLVMStyle.SortIncludes = {/*Enabled=*/true,
@@ -1142,7 +1144,8 @@ void UnwrappedLineParser::parsePPEndIf() {
// If the #endif of a potential include guard is the last thing in the file,
// then we found an include guard.
if (IncludeGuard == IG_Defined && PPBranchLevel == -1 && Tokens->isEOF() &&
- Style.Indent
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/140366
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/140361
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/140497
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -152,6 +152,10 @@ struct IncludeStyle {
/// \version 10
std::string IncludeIsMainSourceRegex;
+ /// When sorting includes in each block, ignore file extensions.
HazardyKnusperkeks wrote:
I currently don't have a better name, but this isn't correct. Yo
@@ -5368,6 +5368,8 @@ struct FormatStyle {
IncludeStyle.IncludeIsMainSourceRegex ==
R.IncludeStyle.IncludeIsMainSourceRegex &&
IncludeStyle.MainIncludeChar == R.IncludeStyle.MainIncludeChar &&
+ IncludeStyle.IncludeSortIgnoreExtens
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/139034
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138440
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138633
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138631
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138440
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1423,7 +1423,7 @@ class AnnotatingParser {
Tok->setType(TT_BitFieldColon);
} else if (Contexts.size() == 1 &&
!Line.First->isOneOf(tok::kw_enum, tok::kw_case,
- tok::kw_default)) {
+
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138389
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138230
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/138229
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -166,6 +166,16 @@ struct IncludeStyle {
/// directives that use the specified character are considered.
/// \version 19
MainIncludeCharDiscriminator MainIncludeChar;
+
+ enum IncludeSortKeyDiscriminator : int8_t {
+/// Includes are sorted alphabetically by their f
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``)
:versionbadge:`clang-format 20`
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
HazardyKnusperkeks wrote:
Did you write this on your own? You need to d
@@ -166,6 +166,16 @@ struct IncludeStyle {
/// directives that use the specified character are considered.
/// \version 19
MainIncludeCharDiscriminator MainIncludeChar;
+
+ enum IncludeSortKeyDiscriminator : int8_t {
HazardyKnusperkeks wrote:
Can you so
@@ -4226,6 +4226,19 @@ the configuration (without a prefix: ``Auto``).
``ClassImpl.hpp`` would not have the main include file put on top
before any other include.
+.. _IncludeSortKey:
+
+**IncludeSortKey** (``IncludeSortKeyDiscriminator``)
:versionbadge:`clang-format 20`
@@ -5283,6 +5299,7 @@ struct FormatStyle {
bool operator==(const FormatStyle &R) const {
return AccessModifierOffset == R.AccessModifierOffset &&
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
+ AlignAfterControlStatement == R.AlignAfterControlSt
HazardyKnusperkeks wrote:
> > You definitely need some tests. And I'm not sure if everyone would like
> > that, of if it should be an option.
>
> I was hoping to get some feedback on whether it should be an option or not
> before adding tests.
I would be in favor.
https://github.com/llvm/llv
https://github.com/HazardyKnusperkeks commented:
How do you think should files be handled, that only differ in the caseness of
the extension?
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http
@@ -4463,6 +4463,14 @@ struct FormatStyle {
/// \version 9
bool SpaceAfterLogicalNot;
+ /// If \c true, a space will be inserted after the ``operator`` keyword.
+ /// \code
+ ///true:false:
+ ///bool operator == (int a) vs.
https://github.com/HazardyKnusperkeks approved this pull request.
From the technical point of view this is fine (given the version number is
corrected). Please wait for feedback from @mydeveloperday .
https://github.com/llvm/llvm-project/pull/137610
_
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/137610
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/137914
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1153,6 +1153,8 @@ template <> struct MappingTraits {
IO.mapOptional("SpaceAfterLogicalNot", Style.SpaceAfterLogicalNot);
IO.mapOptional("SpaceAfterTemplateKeyword",
Style.SpaceAfterTemplateKeyword);
+IO.mapOptional("SpaceAfterOperatorKeyword",
@@ -5433,6 +5441,7 @@ struct FormatStyle {
SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
SpaceAfterLogicalNot == R.SpaceAfterLogicalNot &&
SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword &&
+ SpaceAfterOperatorKeyword == R
@@ -1639,6 +1641,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind
Language) {
LLVMStyle.SpaceAfterCStyleCast = false;
LLVMStyle.SpaceAfterLogicalNot = false;
LLVMStyle.SpaceAfterTemplateKeyword = true;
+ LLVMStyle.SpaceAfterOperatorKeyword = false;
--
@@ -3219,17 +3219,19 @@ static void sortCppIncludes(const FormatStyle &Style,
if (Style.SortIncludes == FormatStyle::SI_CaseInsensitive) {
stable_sort(Indices, [&](unsigned LHSI, unsigned RHSI) {
- const auto LHSFilenameLower = Includes[LHSI].Filename.lower();
-
https://github.com/HazardyKnusperkeks edited
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks commented:
You definitely need some tests. And I'm not sure if everyone would like that,
of if it should be an option.
https://github.com/llvm/llvm-project/pull/137840
___
cfe-commits mailing list
cfe-commits@list
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/137577
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -24954,6 +24954,82 @@ TEST_F(FormatTest, DisableRegions) {
"// clang-format on");
}
+TEST_F(FormatTest, OneLineFormatOffRegex) {
+ auto Style = getLLVMStyle();
+ Style.OneLineFormatOffRegex = "// format off$";
+
+ verifyFormat("// format off\n"
+
@@ -83,8 +83,42 @@ FormatTokenLexer::FormatTokenLexer(
ArrayRef FormatTokenLexer::lex() {
assert(Tokens.empty());
assert(FirstInLineIndex == 0);
+ const llvm::Regex FormatOffRegex(Style.OneLineFormatOffRegex);
+ enum { FO_None, FO_CurrentLine, FO_NextLine } FormatOff = FO
@@ -17630,6 +17630,13 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeParens) {
verifyFormat("int x = int (y);", SomeSpace2);
verifyFormat("auto lambda = []() { return 0; };", SomeSpace2);
+ FormatStyle SpaceAfterOperatorKeyword = getLLVMStyle();
+ SpaceAfterOperatorKeyword
@@ -4471,6 +4471,14 @@ struct FormatStyle {
/// \version 4
bool SpaceAfterTemplateKeyword;
+ /// If \c true, a space will be inserted after the ``operator`` keyword.
+ /// \code
+ ///true:false:
+ ///bool operator == (int a)
@@ -506,8 +512,11 @@ static bool format(StringRef FileName, bool
ErrorOnIncompleteFormat = false) {
// Get new affected ranges after sorting `#includes`.
Ranges = tooling::calculateRangesAfterReplacements(Replaces, Ranges);
FormattingAttemptStatus Status;
- Replacements
@@ -2074,6 +2087,7 @@ class AnnotatingParser {
if (ctx.ContextType == Context::StructArrayInitializer)
return LT_ArrayOfStructInitializer;
+markTokenAsTemplateArgumentInLine();
HazardyKnusperkeks wrote:
I think you want this before the prece
@@ -186,6 +186,9 @@ class AnnotatedLine {
bool MightBeFunctionDecl;
bool IsMultiVariableDeclStmt;
+ /// \c True if this token is part o a template declaration.
+ bool InTemplateDecl = false;
HazardyKnusperkeks wrote:
A leftover?
https://github.com/llvm
@@ -444,6 +444,66 @@ TEST_F(FormatTestComments, UnderstandsBlockComments) {
" int jjj; /*b*/");
}
+TEST_F(FormatTestComments,
HazardyKnusperkeks wrote:
What's your reason for this test? You didn't change anything comment related,
right?
@@ -1259,6 +1259,45 @@ struct FormatStyle {
/// \version 3.7
BinPackParametersStyle BinPackParameters;
+ /// If ``BinPackParameters`` is set to ``AlwaysOnePerLine``, specifies
whether
HazardyKnusperkeks wrote:
Add a reference on `BinPackParameters` to t
@@ -5326,6 +5365,8 @@ struct FormatStyle {
BinPackArguments == R.BinPackArguments &&
BinPackLongBracedList == R.BinPackLongBracedList &&
BinPackParameters == R.BinPackParameters &&
+ ApplyAlwaysOnePerLineToTemplateArguments ==
@@ -9024,6 +9024,55 @@ TEST_F(FormatTest, FormatsDeclarationBreakAlways) {
BreakAlways);
}
+TEST_F(FormatTest, ApplyAlwaysOnePerLineToTemplateArguments) {
+ FormatStyle Style = getGoogleStyle();
HazardyKnusperkeks wrote:
Why google style?
https://gith
@@ -1259,6 +1259,45 @@ struct FormatStyle {
/// \version 3.7
BinPackParametersStyle BinPackParameters;
+ /// If ``BinPackParameters`` is set to ``AlwaysOnePerLine``, specifies
whether
+ /// template argument lists should also be split across multiple lines.
+ ///
+ //
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/137433
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/137430
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/137295
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/137112
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request.
https://github.com/llvm/llvm-project/pull/136662
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
1 - 100 of 1002 matches
Mail list logo