[PATCH] D114430: [clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

2021-11-24 Thread Owen Pan via Phabricator via cfe-commits
owenpan added a comment.

In D114430#3152609 , 
@HazardyKnusperkeks wrote:

> In D114430#3151082 , @klimek wrote:
>
>> Thanks for cleaning up after me, and sorry for the mess - do y'all have 
>> clang-format set up as a presubmit or do you just remember to format 
>> manually?
>
> I think one "problem" is that it did not go through review, otherwise the 
> there were notes in the review. ;)

+1


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114430/new/

https://reviews.llvm.org/D114430

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114430: [clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

2021-11-24 Thread Björn Schäpers via Phabricator via cfe-commits
HazardyKnusperkeks added a comment.

In D114430#3151082 , @klimek wrote:

> Thanks for cleaning up after me, and sorry for the mess - do y'all have 
> clang-format set up as a presubmit or do you just remember to format manually?

I think one "problem" is that it did not go through review, otherwise the there 
were notes in the review. ;)
I use QtCreator with its clang-format integration and the changed lines get 
formatted as soon as I press `;` or `}`. Additionally I can format the current 
line(s).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114430/new/

https://reviews.llvm.org/D114430

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114430: [clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

2021-11-24 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D114430#3151082 , @klimek wrote:

> Thanks for cleaning up after me, and sorry for the mess - do y'all have 
> clang-format set up as a presubmit or do you just remember to format manually?

Its never a problem to clean up after you of all people, happy to do so.

I personally "Format on Save", but my "phabricator patch creation" does a "git 
clang-format" too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114430/new/

https://reviews.llvm.org/D114430

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114430: [clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

2021-11-24 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added a comment.

Thanks for cleaning up after me, and sorry for the mess - do y'all have 
clang-format set up as a presubmit or do you just remember to format manually?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114430/new/

https://reviews.llvm.org/D114430

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D114430: [clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

2021-11-24 Thread MyDeveloperDay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG93fc91610f42: [clang-format] NFC - recent changes caused 
clang-format to no longer be clang… (authored by MyDeveloperDay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114430/new/

https://reviews.llvm.org/D114430

Files:
  clang/lib/Format/Format.cpp
  clang/lib/Format/SortJavaScriptImports.cpp
  clang/lib/Format/TokenAnalyzer.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/WhitespaceManager.cpp

Index: clang/lib/Format/WhitespaceManager.cpp
===
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -913,7 +913,8 @@
   Changes[i].StartOfBlockComment->StartOfTokenColumn -
   Changes[i].StartOfTokenColumn;
 }
-if (Shift < 0) continue;
+if (Shift < 0)
+  continue;
 Changes[i].Spaces += Shift;
 if (i + 1 != Changes.size())
   Changes[i + 1].PreviousEndOfTokenColumn += Shift;
@@ -1269,7 +1270,7 @@
   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
 const Change &C = Changes[i];
 if (i > 0 && Changes[i - 1].OriginalWhitespaceRange.getBegin() ==
- C.OriginalWhitespaceRange.getBegin()) {
+ C.OriginalWhitespaceRange.getBegin()) {
   // Do not generate two replacements for the same location.
   continue;
 }
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -2342,16 +2342,15 @@
 if (NextNonCommentLine && CommentLine &&
 NextNonCommentLine->First->NewlinesBefore <= 1 &&
 NextNonCommentLine->First->OriginalColumn ==
-AL->First->OriginalColumn) {
+AL->First->OriginalColumn) {
   // Align comments for preprocessor lines with the # in column 0 if
   // preprocessor lines are not indented. Otherwise, align with the next
   // line.
-  AL->Level =
-  (Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash &&
-   (NextNonCommentLine->Type == LT_PreprocessorDirective ||
-NextNonCommentLine->Type == LT_ImportStatement))
-  ? 0
-  : NextNonCommentLine->Level;
+  AL->Level = (Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash &&
+   (NextNonCommentLine->Type == LT_PreprocessorDirective ||
+NextNonCommentLine->Type == LT_ImportStatement))
+  ? 0
+  : NextNonCommentLine->Level;
 } else {
   NextNonCommentLine = AL->First->isNot(tok::r_brace) ? AL : nullptr;
 }
Index: clang/lib/Format/TokenAnalyzer.cpp
===
--- clang/lib/Format/TokenAnalyzer.cpp
+++ clang/lib/Format/TokenAnalyzer.cpp
@@ -37,7 +37,7 @@
 
 // FIXME: Instead of printing the diagnostic we should store it and have a
 // better way to return errors through the format APIs.
-class FatalDiagnosticConsumer: public DiagnosticConsumer {
+class FatalDiagnosticConsumer : public DiagnosticConsumer {
 public:
   void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
 const Diagnostic &Info) override {
@@ -71,7 +71,8 @@
   }
   // Validate that we can get the buffer data without a fatal error.
   Env->SM.getBufferData(Env->ID);
-  if (Diags.fatalError()) return nullptr;
+  if (Diags.fatalError())
+return nullptr;
   return Env;
 }
 
@@ -80,8 +81,7 @@
  unsigned LastStartColumn)
 : VirtualSM(new SourceManagerForFile(FileName, Code)), SM(VirtualSM->get()),
   ID(VirtualSM->get().getMainFileID()), FirstStartColumn(FirstStartColumn),
-  NextStartColumn(NextStartColumn), LastStartColumn(LastStartColumn) {
-}
+  NextStartColumn(NextStartColumn), LastStartColumn(LastStartColumn) {}
 
 TokenAnalyzer::TokenAnalyzer(const Environment &Env, const FormatStyle &Style)
 : Style(Style), Env(Env),
Index: clang/lib/Format/SortJavaScriptImports.cpp
===
--- clang/lib/Format/SortJavaScriptImports.cpp
+++ clang/lib/Format/SortJavaScriptImports.cpp
@@ -553,9 +553,7 @@
   auto Env = Environment::make(Code, FileName, Ranges);
   if (!Env)
 return {};
-  return JavaScriptImportSorter(*Env, Style)
-  .process()
-  .first;
+  return JavaScriptImportSorter(*Env, Style).process().first;
 }
 
 } // end namespace format
Index: clang/lib/Format/Format.cpp
===
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -2988,9 +2988,8 @@
   // JSON only needs the formatting passing.
   if (Style.isJson()) {
 std::vector Ranges(1, tooling::Range(0, Code.size()));
-auto Env =
-Environment::make(Code, FileName

[PATCH] D114430: [clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.

2021-11-23 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: klimek, HazardyKnusperkeks, curdeius, owenpan.
MyDeveloperDay added projects: clang, clang-format.
MyDeveloperDay requested review of this revision.

The following 2 commits caused files in clang-format to no longer be 
clang-formatted.

we would lose our "clean" status 
https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormattedStatus.html

c2271926a4fc 
  - Make 
clang-format fuzz through Lexing with asserts enabled 
(https://github.com/llvm/llvm-project/commit/c2271926a4fc )

84bf5e328664 
 - Fix 
various problems found by fuzzing. 
(https://github.com/llvm/llvm-project/commit/84bf5e328664)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114430

Files:
  clang/lib/Format/Format.cpp
  clang/lib/Format/SortJavaScriptImports.cpp
  clang/lib/Format/TokenAnalyzer.cpp
  clang/lib/Format/TokenAnnotator.cpp
  clang/lib/Format/WhitespaceManager.cpp

Index: clang/lib/Format/WhitespaceManager.cpp
===
--- clang/lib/Format/WhitespaceManager.cpp
+++ clang/lib/Format/WhitespaceManager.cpp
@@ -913,7 +913,8 @@
   Changes[i].StartOfBlockComment->StartOfTokenColumn -
   Changes[i].StartOfTokenColumn;
 }
-if (Shift < 0) continue;
+if (Shift < 0)
+  continue;
 Changes[i].Spaces += Shift;
 if (i + 1 != Changes.size())
   Changes[i + 1].PreviousEndOfTokenColumn += Shift;
@@ -1269,7 +1270,7 @@
   for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
 const Change &C = Changes[i];
 if (i > 0 && Changes[i - 1].OriginalWhitespaceRange.getBegin() ==
- C.OriginalWhitespaceRange.getBegin()) {
+ C.OriginalWhitespaceRange.getBegin()) {
   // Do not generate two replacements for the same location.
   continue;
 }
Index: clang/lib/Format/TokenAnnotator.cpp
===
--- clang/lib/Format/TokenAnnotator.cpp
+++ clang/lib/Format/TokenAnnotator.cpp
@@ -2342,16 +2342,15 @@
 if (NextNonCommentLine && CommentLine &&
 NextNonCommentLine->First->NewlinesBefore <= 1 &&
 NextNonCommentLine->First->OriginalColumn ==
-AL->First->OriginalColumn) {
+AL->First->OriginalColumn) {
   // Align comments for preprocessor lines with the # in column 0 if
   // preprocessor lines are not indented. Otherwise, align with the next
   // line.
-  AL->Level =
-  (Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash &&
-   (NextNonCommentLine->Type == LT_PreprocessorDirective ||
-NextNonCommentLine->Type == LT_ImportStatement))
-  ? 0
-  : NextNonCommentLine->Level;
+  AL->Level = (Style.IndentPPDirectives != FormatStyle::PPDIS_BeforeHash &&
+   (NextNonCommentLine->Type == LT_PreprocessorDirective ||
+NextNonCommentLine->Type == LT_ImportStatement))
+  ? 0
+  : NextNonCommentLine->Level;
 } else {
   NextNonCommentLine = AL->First->isNot(tok::r_brace) ? AL : nullptr;
 }
Index: clang/lib/Format/TokenAnalyzer.cpp
===
--- clang/lib/Format/TokenAnalyzer.cpp
+++ clang/lib/Format/TokenAnalyzer.cpp
@@ -37,7 +37,7 @@
 
 // FIXME: Instead of printing the diagnostic we should store it and have a
 // better way to return errors through the format APIs.
-class FatalDiagnosticConsumer: public DiagnosticConsumer {
+class FatalDiagnosticConsumer : public DiagnosticConsumer {
 public:
   void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
 const Diagnostic &Info) override {
@@ -71,7 +71,8 @@
   }
   // Validate that we can get the buffer data without a fatal error.
   Env->SM.getBufferData(Env->ID);
-  if (Diags.fatalError()) return nullptr;
+  if (Diags.fatalError())
+return nullptr;
   return Env;
 }
 
@@ -80,8 +81,7 @@
  unsigned LastStartColumn)
 : VirtualSM(new SourceManagerForFile(FileName, Code)), SM(VirtualSM->get()),
   ID(VirtualSM->get().getMainFileID()), FirstStartColumn(FirstStartColumn),
-  NextStartColumn(NextStartColumn), LastStartColumn(LastStartColumn) {
-}
+  NextStartColumn(NextStartColumn), LastStartColumn(LastStartColumn) {}
 
 TokenAnalyzer::TokenAnalyzer(const Environment &Env, const FormatStyle &Style)
 : Style(Style), Env(Env),
Index: clang/lib/Format/SortJavaScriptImports.cpp
===
--- clang/lib/Format/SortJavaScriptImports.cpp
+++ clang/lib/Format/SortJavaScriptImports.cpp
@@ -553,9 +553,7 @@
   auto Env = Environment::make(Code, FileName, Ranges);
   if (!Env)
 return {};
-  return JavaScript