[clang] a07dbf1 - [clang][NFC] Annotate `PrettyPrinter.h` with `preferred_type`

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 5 23:58:35 PST 2023


Author: Vlad Serebrennikov
Date: 2023-11-06T10:58:27+03:00
New Revision: a07dbf1fb0f4ba36911233c82914a9ddf3eb4a09

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

LOG: [clang][NFC] Annotate `PrettyPrinter.h` with `preferred_type`

Added: 
    

Modified: 
    clang/include/clang/AST/PrettyPrinter.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h
index cee3cce7729c30f..da276e26049b00a 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -106,6 +106,7 @@ struct PrintingPolicy {
   /// declaration for "x", so that we will print "int *x"; it will be
   /// \c true when we print "y", so that we suppress printing the
   /// "const int" type specifier and instead only print the "*y".
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressSpecifiers : 1;
 
   /// Whether type printing should skip printing the tag keyword.
@@ -116,6 +117,7 @@ struct PrintingPolicy {
   /// \code
   /// struct Geometry::Point;
   /// \endcode
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressTagKeyword : 1;
 
   /// When true, include the body of a tag definition.
@@ -126,22 +128,27 @@ struct PrintingPolicy {
   /// \code
   /// typedef struct { int x, y; } Point;
   /// \endcode
+  LLVM_PREFERRED_TYPE(bool)
   unsigned IncludeTagDefinition : 1;
 
   /// Suppresses printing of scope specifiers.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressScope : 1;
 
   /// Suppress printing parts of scope specifiers that are never
   /// written, e.g., for anonymous namespaces.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressUnwrittenScope : 1;
 
   /// Suppress printing parts of scope specifiers that correspond
   /// to inline namespaces, where the name is unambiguous with the specifier
   /// removed.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressInlineNamespace : 1;
 
   /// Ignore qualifiers and tag keywords as specified by elaborated type sugar,
   /// instead letting the underlying type print as normal.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressElaboration : 1;
 
   /// Suppress printing of variable initializers.
@@ -155,6 +162,7 @@ struct PrintingPolicy {
   ///
   /// SuppressInitializers will be true when printing "auto x", so that the
   /// internal initializer constructed for x will not be printed.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressInitializers : 1;
 
   /// Whether we should print the sizes of constant array expressions as written
@@ -173,53 +181,67 @@ struct PrintingPolicy {
   /// int a[104];
   /// char a[9] = "A string";
   /// \endcode
+  LLVM_PREFERRED_TYPE(bool)
   unsigned ConstantArraySizeAsWritten : 1;
 
   /// When printing an anonymous tag name, also print the location of that
   /// entity (e.g., "enum <anonymous at t.h:10:5>"). Otherwise, just prints
   /// "(anonymous)" for the name.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned AnonymousTagLocations : 1;
 
   /// When true, suppress printing of the __strong lifetime qualifier in ARC.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressStrongLifetime : 1;
 
   /// When true, suppress printing of lifetime qualifier in ARC.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressLifetimeQualifiers : 1;
 
   /// When true, suppresses printing template arguments in names of C++
   /// constructors.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressTemplateArgsInCXXConstructors : 1;
 
   /// When true, attempt to suppress template arguments that match the default
   /// argument for the parameter.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressDefaultTemplateArgs : 1;
 
   /// Whether we can use 'bool' rather than '_Bool' (even if the language
   /// doesn't actually have 'bool', because, e.g., it is defined as a macro).
+  LLVM_PREFERRED_TYPE(bool)
   unsigned Bool : 1;
 
   /// Whether we should use 'nullptr' rather than '0' as a null pointer
   /// constant.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned Nullptr : 1;
 
   /// Whether 'nullptr_t' is in namespace 'std' or not.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned NullptrTypeInNamespace : 1;
 
   /// Whether we can use 'restrict' rather than '__restrict'.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned Restrict : 1;
 
   /// Whether we can use 'alignof' rather than '__alignof'.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned Alignof : 1;
 
   /// Whether we can use '_Alignof' rather than '__alignof'.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned UnderscoreAlignof : 1;
 
   /// Whether we should use '(void)' rather than '()' for a function prototype
   /// with zero parameters.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned UseVoidForZeroParams : 1;
 
   /// Whether nested templates must be closed like 'a\<b\<c\> \>' rather than
   /// 'a\<b\<c\>\>'.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SplitTemplateClosers : 1;
 
   /// Provide a 'terse' output.
@@ -227,27 +249,33 @@ struct PrintingPolicy {
   /// For example, in this mode we don't print function bodies, class members,
   /// declarations inside namespaces etc.  Effectively, this should print
   /// only the requested declaration.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned TerseOutput : 1;
 
   /// When true, do certain refinement needed for producing proper declaration
   /// tag; such as, do not print attributes attached to the declaration.
   ///
+  LLVM_PREFERRED_TYPE(bool)
   unsigned PolishForDeclaration : 1;
 
   /// When true, print the half-precision floating-point type as 'half'
   /// instead of '__fp16'
+  LLVM_PREFERRED_TYPE(bool)
   unsigned Half : 1;
 
   /// When true, print the built-in wchar_t type as __wchar_t. For use in
   /// Microsoft mode when wchar_t is not available.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned MSWChar : 1;
 
   /// When true, include newlines after statements like "break", etc.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned IncludeNewlines : 1;
 
   /// Use whitespace and punctuation like MSVC does. In particular, this prints
   /// anonymous namespaces as `anonymous namespace' and does not insert spaces
   /// after template arguments.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned MSVCFormatting : 1;
 
   /// Whether we should print the constant expressions as written in the
@@ -266,42 +294,52 @@ struct PrintingPolicy {
   /// 0x10
   /// 2.5e3
   /// \endcode
+  LLVM_PREFERRED_TYPE(bool)
   unsigned ConstantsAsWritten : 1;
 
   /// When true, don't print the implicit 'self' or 'this' expressions.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned SuppressImplicitBase : 1;
 
   /// When true, print the fully qualified name of function declarations.
   /// This is the opposite of SuppressScope and thus overrules it.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned FullyQualifiedName : 1;
 
   /// Whether to print types as written or canonically.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned PrintCanonicalTypes : 1;
 
   /// Whether to print an InjectedClassNameType with template arguments or as
   /// written. When a template argument is unnamed, printing it results in
   /// invalid C++ code.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned PrintInjectedClassNameWithArguments : 1;
 
   /// Whether to use C++ template preferred_name attributes when printing
   /// templates.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned UsePreferredNames : 1;
 
   /// Whether to use type suffixes (eg: 1U) on integral non-type template
   /// parameters.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned AlwaysIncludeTypeForTemplateArgument : 1;
 
   /// Whether to strip underscores when printing reserved parameter names.
   /// e.g. std::vector<class _Tp> becomes std::vector<class Tp>.
   /// This only affects parameter names, and so describes a compatible API.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned CleanUglifiedParameters : 1;
 
   /// Whether to print the entire array initializers, especially on non-type
   /// template parameters, no matter how many elements there are.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned EntireContentsOfLargeArray : 1;
 
   /// Whether to print enumerator non-type template parameters with a matching
   /// enumerator name or via cast of an integer.
+  LLVM_PREFERRED_TYPE(bool)
   unsigned UseEnumerators : 1;
 
   /// Callbacks to use to allow the behavior of printing to be customized.


        


More information about the cfe-commits mailing list