struct PrintingPolicy

Declaration

struct PrintingPolicy { /* full declaration omitted */ };

Description

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.

Declared at: clang/include/clang/AST/PrettyPrinter.h:57

Member Variables

public unsigned int Indentation
The number of spaces to use to indent each line.
public unsigned int SuppressSpecifiers
SuppressSpecifiers will be false when printing the 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".
public unsigned int SuppressTagKeyword
public unsigned int IncludeTagDefinition
public unsigned int SuppressScope
Suppresses printing of scope specifiers.
public unsigned int SuppressUnwrittenScope
Suppress printing parts of scope specifiers that are never written, e.g., for anonymous namespaces.
public unsigned int SuppressInlineNamespace
Suppress printing parts of scope specifiers that correspond to inline namespaces, where the name is unambiguous with the specifier removed.
public unsigned int SuppressInitializers
SuppressInitializers will be true when printing "auto x", so that the internal initializer constructed for x will not be printed.
public unsigned int ConstantArraySizeAsWritten
public unsigned int AnonymousTagLocations
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.
public unsigned int SuppressStrongLifetime
When true, suppress printing of the __strong lifetime qualifier in ARC.
public unsigned int SuppressLifetimeQualifiers
When true, suppress printing of lifetime qualifier in ARC.
public unsigned int SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
public unsigned int SuppressDefaultTemplateArgs
When true, attempt to suppress template arguments that match the default argument for the parameter.
public unsigned int Bool
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).
public unsigned int Nullptr
Whether we should use 'nullptr' rather than '0' as a null pointer constant.
public unsigned int Restrict
Whether we can use 'restrict' rather than '__restrict'.
public unsigned int Alignof
Whether we can use 'alignof' rather than '__alignof'.
public unsigned int UnderscoreAlignof
Whether we can use '_Alignof' rather than '__alignof'.
public unsigned int UseVoidForZeroParams
Whether we should use '(void)' rather than '()' for a function prototype with zero parameters.
public unsigned int SplitTemplateClosers
Whether nested templates must be closed like 'a < b < c > > ' rather than 'a < b < c > > '.
public unsigned int TerseOutput
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.
public unsigned int PolishForDeclaration
When true, do certain refinement needed for producing proper declaration tag; such as, do not print attributes attached to the declaration.
public unsigned int Half
When true, print the half-precision floating-point type as 'half' instead of '__fp16'
public unsigned int MSWChar
When true, print the built-in wchar_t type as __wchar_t. For use in Microsoft mode when wchar_t is not available.
public unsigned int IncludeNewlines
When true, include newlines after statements like "break", etc.
public unsigned int MSVCFormatting
Use whitespace and punctuation like MSVC does. In particular, this prints anonymous namespaces as `anonymous namespace' and does not insert spaces after template arguments.
public unsigned int ConstantsAsWritten
public unsigned int SuppressImplicitBase
When true, don't print the implicit 'self' or 'this' expressions.
public unsigned int FullyQualifiedName
When true, print the fully qualified name of function declarations. This is the opposite of SuppressScope and thus overrules it.
public unsigned int PrintCanonicalTypes
Whether to print types as written or canonically.
public unsigned int 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.
public unsigned int UsePreferredNames
Whether to use C++ template preferred_name attributes when printing templates.
public unsigned int AlwaysIncludeTypeForTemplateArgument
Whether to use type suffixes (eg: 1U) on integral non-type template parameters.
public unsigned int CleanUglifiedParameters
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.
public unsigned int EntireContentsOfLargeArray
Whether to print the entire array initializers, especially on non-type template parameters, no matter how many elements there are.
public unsigned int UseEnumerators
Whether to print enumerator non-type template parameters with a matching enumerator name or via cast of an integer.
public const clang::PrintingCallbacks* Callbacks = nullptr
Callbacks to use to allow the behavior of printing to be customized.

Method Overview

Methods

PrintingPolicy(const clang::LangOptions& LO)

Description

Create a default printing policy for the specified language.

Declared at: clang/include/clang/AST/PrettyPrinter.h:59

Parameters

const clang::LangOptions& LO

void adjustForCPlusPlus()

Description

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). This should not be used if a real LangOptions object is available.

Declared at: clang/include/clang/AST/PrettyPrinter.h:84