owenpan added inline comments.

================
Comment at: clang/lib/Format/Format.cpp:3476-3477
+
+  // Regarding the 16: Note that multiple passes are added in
+  // addQualifierAlignmentFixerPasses().
+  SmallVector<AnalyzerPass, 16> Passes;
----------------
This comment is unnecessary and too verbose IMO. I suggest that it be deleted.


================
Comment at: clang/lib/Format/Format.cpp:3571-3585
+  // Don't make replacements that replace nothing. This can affect e.g. the
+  // output of clang-format with the --output-replacements-xml option.
+  tooling::Replacements NonNoOpFixes;
+  for (const tooling::Replacement &Fix : Fixes) {
+    StringRef OriginalCode = Code.substr(Fix.getOffset(), Fix.getLength());
+    if (!OriginalCode.equals(Fix.getReplacementText())) {
+      auto Err = NonNoOpFixes.add(Fix);
----------------
You only need this for the `QualifierAlignment` passes as others (e.g. 
`IntegerLiteralSeparatorFixer`) already skip no-op replacements.


================
Comment at: clang/lib/Format/QualifierAlignmentFixer.cpp:29
+void addQualifierAlignmentFixerPasses(const FormatStyle &Style,
+                                      SmallVector<AnalyzerPass, 16> &Passes) {
   std::vector<std::string> LeftOrder;
----------------
Ditto.


================
Comment at: clang/lib/Format/QualifierAlignmentFixer.h:29
+void addQualifierAlignmentFixerPasses(const FormatStyle &Style,
+                                      SmallVector<AnalyzerPass, 16> &Passes);
 
----------------
See https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153228

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

Reply via email to