clang: clang::PrintingPolicy Struct Reference (original) (raw)

Describes how types, statements, expressions, and declarations should be printed. More...

#include "[clang/AST/PrettyPrinter.h](PrettyPrinter%5F8h%5Fsource.html)"

Public Types
enum class SuppressInlineNamespaceMode : uint8_t { None, Redundant, All }
Public Member Functions
PrintingPolicy (const LangOptions &LO)
Create a default printing policy for the specified language.
void adjustForCPlusPlus ()
Adjust this printing policy for cases where it's known that we're printing C++ code (for instance, if AST dumping reaches a C++-only construct).
Public Attributes
unsigned Indentation: 8
The number of spaces to use to indent each line.
unsigned SuppressSpecifiers: 1
Whether we should suppress printing of the actual specifiers for the given type or declaration.
unsigned SuppressTagKeyword: 1
Whether type printing should skip printing the tag keyword.
unsigned IncludeTagDefinition: 1
When true, include the body of a tag definition.
unsigned SuppressScope: 1
Suppresses printing of scope specifiers.
unsigned SuppressUnwrittenScope: 1
Suppress printing parts of scope specifiers that are never written, e.g., for anonymous namespaces.
unsigned SuppressInlineNamespace: 2
Suppress printing parts of scope specifiers that correspond to inline namespaces.
unsigned SuppressInitializers: 1
Suppress printing of variable initializers.
unsigned ConstantArraySizeAsWritten: 1
Whether we should print the sizes of constant array expressions as written in the sources.
unsigned AnonymousTagLocations: 1
When printing an anonymous tag name, also print the location of that entity (e.g., "enum ").
unsigned SuppressStrongLifetime: 1
When true, suppress printing of the __strong lifetime qualifier in ARC.
unsigned SuppressLifetimeQualifiers: 1
When true, suppress printing of lifetime qualifier in ARC.
unsigned SuppressTemplateArgsInCXXConstructors: 1
When true, suppresses printing template arguments in names of C++ constructors.
unsigned SuppressDefaultTemplateArgs: 1
When true, attempt to suppress template arguments that match the default argument for the parameter.
unsigned Bool: 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).
unsigned Nullptr: 1
Whether we should use 'nullptr' rather than '0' as a null pointer constant.
unsigned NullptrTypeInNamespace: 1
Whether 'nullptr_t' is in namespace 'std' or not.
unsigned Restrict: 1
Whether we can use 'restrict' rather than '__restrict'.
unsigned Alignof: 1
Whether we can use 'alignof' rather than '__alignof'.
unsigned UnderscoreAlignof: 1
Whether we can use '_Alignof' rather than '__alignof'.
unsigned UseVoidForZeroParams: 1
Whether we should use '(void)' rather than '()' for a function prototype with zero parameters.
unsigned SplitTemplateClosers: 1
Whether nested templates must be closed like 'a<b >' rather than 'a<b>'.
unsigned TerseOutput: 1
Provide a 'terse' output.
unsigned PolishForDeclaration: 1
When true, do certain refinement needed for producing proper declaration tag; such as, do not print attributes attached to the declaration.
unsigned Half: 1
When true, print the half-precision floating-point type as 'half' instead of '__fp16'.
unsigned MSWChar: 1
When true, print the built-in wchar_t type as __wchar_t.
unsigned IncludeNewlines: 1
When true, include newlines after statements like "break", etc.
unsigned MSVCFormatting: 1
Use whitespace and punctuation like MSVC does.
unsigned ConstantsAsWritten: 1
Whether we should print the constant expressions as written in the sources.
unsigned SuppressImplicitBase: 1
When true, don't print the implicit 'self' or 'this' expressions.
unsigned FullyQualifiedName: 1
When true, print the fully qualified name of function declarations.
unsigned PrintAsCanonical: 1
Whether to print entities as written or canonically.
unsigned PrintInjectedClassNameWithArguments: 1
Whether to print an InjectedClassNameType with template arguments or as written.
unsigned UsePreferredNames: 1
Whether to use C++ template preferred_name attributes when printing templates.
unsigned AlwaysIncludeTypeForTemplateArgument: 1
Whether to use type suffixes (eg: 1U) on integral non-type template parameters.
unsigned CleanUglifiedParameters: 1
Whether to strip underscores when printing reserved parameter names.
unsigned EntireContentsOfLargeArray: 1
Whether to print the entire array initializers, especially on non-type template parameters, no matter how many elements there are.
unsigned UseEnumerators: 1
Whether to print enumerator non-type template parameters with a matching enumerator name or via cast of an integer.
unsigned UseHLSLTypes: 1
Whether or not we're printing known HLSL code and should print HLSL sugared types when possible.
const PrintingCallbacks * Callbacks = nullptr
Callbacks to use to allow the behavior of printing to be customized.

Describes how types, statements, expressions, and declarations should be printed.

This type is intended to be small and suitable for passing by value. It is very frequently copied.

Definition at line 58 of file PrettyPrinter.h.

SuppressInlineNamespaceMode

clang::PrintingPolicy::PrintingPolicy ( const LangOptions & LO) inline

Create a default printing policy for the specified language.

Definition at line 62 of file PrettyPrinter.h.

References Alignof, AlwaysIncludeTypeForTemplateArgument, AnonymousTagLocations, Bool, clang::C11, clang::C23, clang::C99, CleanUglifiedParameters, ConstantArraySizeAsWritten, ConstantsAsWritten, clang::CPlusPlus, clang::CPlusPlus11, EntireContentsOfLargeArray, false, FullyQualifiedName, Half, clang::HLSL, IncludeNewlines, IncludeTagDefinition, Indentation, MSVCFormatting, MSWChar, Nullptr, NullptrTypeInNamespace, PolishForDeclaration, PrintAsCanonical, PrintInjectedClassNameWithArguments, Redundant, Restrict, SplitTemplateClosers, SuppressDefaultTemplateArgs, SuppressImplicitBase, SuppressInitializers, SuppressInlineNamespace, SuppressLifetimeQualifiers, SuppressScope, SuppressSpecifiers, SuppressStrongLifetime, SuppressTagKeyword, SuppressTemplateArgsInCXXConstructors, SuppressUnwrittenScope, TerseOutput, true, UnderscoreAlignof, UseEnumerators, UseHLSLTypes, UsePreferredNames, and UseVoidForZeroParams.

adjustForCPlusPlus()

void clang::PrintingPolicy::adjustForCPlusPlus ( ) inline

Alignof

AlwaysIncludeTypeForTemplateArgument

unsigned clang::PrintingPolicy::AlwaysIncludeTypeForTemplateArgument

AnonymousTagLocations

unsigned clang::PrintingPolicy::AnonymousTagLocations

Bool

Callbacks

CleanUglifiedParameters

unsigned clang::PrintingPolicy::CleanUglifiedParameters

ConstantArraySizeAsWritten

unsigned clang::PrintingPolicy::ConstantArraySizeAsWritten

Whether we should print the sizes of constant array expressions as written in the sources.

This flag determines whether array types declared as

int a[4+10*10];

char a[] = "A string";

will be printed as written or as follows:

int a[104];

char a[9] = "A string";

Definition at line 186 of file PrettyPrinter.h.

Referenced by PrintingPolicy(), and printQualifier().

ConstantsAsWritten

unsigned clang::PrintingPolicy::ConstantsAsWritten

Whether we should print the constant expressions as written in the sources.

This flag determines whether constants expressions like

will be printed as written or as follows:

Definition at line 299 of file PrettyPrinter.h.

Referenced by PrintingPolicy().

EntireContentsOfLargeArray

unsigned clang::PrintingPolicy::EntireContentsOfLargeArray

FullyQualifiedName

unsigned clang::PrintingPolicy::FullyQualifiedName

Half

IncludeNewlines

unsigned clang::PrintingPolicy::IncludeNewlines

IncludeTagDefinition

unsigned clang::PrintingPolicy::IncludeTagDefinition

When true, include the body of a tag definition.

This is used to place the definition of a struct in the middle of another declaration as with:

typedef struct { int x, y; } Point;

Definition at line 136 of file PrettyPrinter.h.

Referenced by PrintingPolicy().

Indentation

unsigned clang::PrintingPolicy::Indentation

MSVCFormatting

unsigned clang::PrintingPolicy::MSVCFormatting

MSWChar

Nullptr

NullptrTypeInNamespace

unsigned clang::PrintingPolicy::NullptrTypeInNamespace

PolishForDeclaration

unsigned clang::PrintingPolicy::PolishForDeclaration

When true, do certain refinement needed for producing proper declaration tag; such as, do not print attributes attached to the declaration.

Definition at line 260 of file PrettyPrinter.h.

Referenced by PrintingPolicy().

PrintAsCanonical

unsigned clang::PrintingPolicy::PrintAsCanonical

PrintInjectedClassNameWithArguments

unsigned clang::PrintingPolicy::PrintInjectedClassNameWithArguments

Whether to print an InjectedClassNameType with template arguments or as written.

When a template argument is unnamed, printing it results in invalid C++ code.

Definition at line 318 of file PrettyPrinter.h.

Referenced by PrintingPolicy().

Restrict

unsigned clang::PrintingPolicy::Restrict

SplitTemplateClosers

unsigned clang::PrintingPolicy::SplitTemplateClosers

SuppressDefaultTemplateArgs

unsigned clang::PrintingPolicy::SuppressDefaultTemplateArgs

SuppressImplicitBase

unsigned clang::PrintingPolicy::SuppressImplicitBase

SuppressInitializers

unsigned clang::PrintingPolicy::SuppressInitializers

Suppress printing of variable initializers.

This flag is used when printing the loop variable in a for-range statement. For example, given:

SuppressInitializers will be true when printing "auto x", so that the internal initializer constructed for x will not be printed.

Definition at line 167 of file PrettyPrinter.h.

Referenced by PrintingPolicy().

SuppressInlineNamespace

unsigned clang::PrintingPolicy::SuppressInlineNamespace

SuppressLifetimeQualifiers

unsigned clang::PrintingPolicy::SuppressLifetimeQualifiers

SuppressScope

unsigned clang::PrintingPolicy::SuppressScope

SuppressSpecifiers

unsigned clang::PrintingPolicy::SuppressSpecifiers

Whether we should suppress printing of the actual specifiers for the given type or declaration.

This flag is only used when we are printing declarators beyond the first declarator within a declaration group. For example, given:

SuppressSpecifiers will be false when printing the declaration for "x", so that we will print "int *x"; it will be true when we print "y", so that we suppress printing the "const int" type specifier and instead only print the "*y".

Definition at line 114 of file PrettyPrinter.h.

Referenced by clang::Decl::printGroup(), and PrintingPolicy().

SuppressStrongLifetime

unsigned clang::PrintingPolicy::SuppressStrongLifetime

SuppressTagKeyword

unsigned clang::PrintingPolicy::SuppressTagKeyword

SuppressTemplateArgsInCXXConstructors

unsigned clang::PrintingPolicy::SuppressTemplateArgsInCXXConstructors

SuppressUnwrittenScope

unsigned clang::PrintingPolicy::SuppressUnwrittenScope

TerseOutput

unsigned clang::PrintingPolicy::TerseOutput

UnderscoreAlignof

unsigned clang::PrintingPolicy::UnderscoreAlignof

UseEnumerators

unsigned clang::PrintingPolicy::UseEnumerators

UseHLSLTypes

unsigned clang::PrintingPolicy::UseHLSLTypes

Whether or not we're printing known HLSL code and should print HLSL sugared types when possible.

Definition at line 349 of file PrettyPrinter.h.

Referenced by PrintingPolicy().

UsePreferredNames

unsigned clang::PrintingPolicy::UsePreferredNames

UseVoidForZeroParams

unsigned clang::PrintingPolicy::UseVoidForZeroParams


The documentation for this struct was generated from the following file: