[clang] dd3caa9 - [clang-format] [docs] [NFC] improve clarity in the QualifierAlignment warning

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 2 05:19:01 PDT 2021


Author: mydeveloperday
Date: 2021-10-02T13:18:42+01:00
New Revision: dd3caa99bd874671a4c5c9657bd5e335dbfd3e0a

URL: https://github.com/llvm/llvm-project/commit/dd3caa99bd874671a4c5c9657bd5e335dbfd3e0a
DIFF: https://github.com/llvm/llvm-project/commit/dd3caa99bd874671a4c5c9657bd5e335dbfd3e0a.diff

LOG: [clang-format] [docs] [NFC] improve clarity in the QualifierAlignment warning

Improve the clarity and guidance of the warning when using code modifying option in clang-format see {D69764}

Reviewed By: HazardyKnusperkeks, curdeius

Differential Revision: https://reviews.llvm.org/D110801

Added: 
    

Modified: 
    clang/docs/ClangFormatStyleOptions.rst
    clang/include/clang/Format/Format.h

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 7e4d1582d866f..c05fbc753614e 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -3238,7 +3238,11 @@ the configuration (without a prefix: ``Auto``).
 
   .. warning:: 
 
-   ``QualifierAlignment`` COULD lead to incorrect code generation.
+   Setting ``QualifierAlignment``  to something other than `Leave`, COULD
+   lead to incorrect code formatting due to incorrect decisions made due to
+   clang-formats lack of complete semantic information.
+   As such extra care should be taken to review code changes made by the use
+   of this option.
 
   Possible values:
 

diff  --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index a6fd44693a033..df553c3428052 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -1898,7 +1898,11 @@ struct FormatStyle {
 
   /// Different ways to arrange specifiers and qualifiers (e.g. const/volatile).
   /// \warning
-  ///  ``QualifierAlignment`` COULD lead to incorrect code generation.
+  ///  Setting ``QualifierAlignment``  to something other than `Leave`, COULD
+  ///  lead to incorrect code formatting due to incorrect decisions made due to
+  ///  clang-formats lack of complete semantic information.
+  ///  As such extra care should be taken to review code changes made by the use
+  ///  of this option.
   /// \endwarning
   /// \version 14
   QualifierAlignmentStyle QualifierAlignment;


        


More information about the cfe-commits mailing list