SamMaier updated this revision to Diff 221065.
SamMaier added a comment.

Diff with more context


Repository:
  rC Clang

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

https://reviews.llvm.org/D67843

Files:
  clang/lib/Format/Format.cpp
  clang/test/Format/disable-format.cpp


Index: clang/test/Format/disable-format.cpp
===================================================================
--- clang/test/Format/disable-format.cpp
+++ clang/test/Format/disable-format.cpp
@@ -1,5 +1,9 @@
 // RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=none \
 // RUN:   | FileCheck -strict-whitespace %s
 
-// CHECK: int   i;
+// CHECK: #include <b>
+// CHECK-NEXT: #include <a>
+// CHECK-NEXT: int   i;
+#include <b>
+#include <a>
 int   i;
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -1062,8 +1062,6 @@
 FormatStyle getNoStyle() {
   FormatStyle NoStyle = getLLVMStyle();
   NoStyle.DisableFormat = true;
-  NoStyle.SortIncludes = false;
-  NoStyle.SortUsingDeclarations = false;
   return NoStyle;
 }
 
@@ -2130,7 +2128,7 @@
                                    ArrayRef<tooling::Range> Ranges,
                                    StringRef FileName, unsigned *Cursor) {
   tooling::Replacements Replaces;
-  if (!Style.SortIncludes)
+  if (!Style.SortIncludes || Style.DisableFormat)
     return Replaces;
   if (isLikelyXml(Code))
     return Replaces;


Index: clang/test/Format/disable-format.cpp
===================================================================
--- clang/test/Format/disable-format.cpp
+++ clang/test/Format/disable-format.cpp
@@ -1,5 +1,9 @@
 // RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=none \
 // RUN:   | FileCheck -strict-whitespace %s
 
-// CHECK: int   i;
+// CHECK: #include <b>
+// CHECK-NEXT: #include <a>
+// CHECK-NEXT: int   i;
+#include <b>
+#include <a>
 int   i;
Index: clang/lib/Format/Format.cpp
===================================================================
--- clang/lib/Format/Format.cpp
+++ clang/lib/Format/Format.cpp
@@ -1062,8 +1062,6 @@
 FormatStyle getNoStyle() {
   FormatStyle NoStyle = getLLVMStyle();
   NoStyle.DisableFormat = true;
-  NoStyle.SortIncludes = false;
-  NoStyle.SortUsingDeclarations = false;
   return NoStyle;
 }
 
@@ -2130,7 +2128,7 @@
                                    ArrayRef<tooling::Range> Ranges,
                                    StringRef FileName, unsigned *Cursor) {
   tooling::Replacements Replaces;
-  if (!Style.SortIncludes)
+  if (!Style.SortIncludes || Style.DisableFormat)
     return Replaces;
   if (isLikelyXml(Code))
     return Replaces;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to