clang API Documentation

Public Member Functions | Public Attributes
clang::PrintingPolicy Struct Reference

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

#include <PrettyPrinter.h>

Collaboration diagram for clang::PrintingPolicy:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PrintingPolicy (const LangOptions &LO)
 Create a default printing policy for C.

Public Attributes

LangOptions LangOpts
 What language we're printing.
unsigned Indentation: 8
 The number of spaces to use to indent each line.
bool SuppressSpecifiers: 1
 Whether we should suppress printing of the actual specifiers for the given type or declaration.
bool SuppressTagKeyword: 1
 Whether type printing should skip printing the tag keyword.
bool SuppressTag: 1
 Whether type printing should skip printing the actual tag type.
bool SuppressScope: 1
 Suppresses printing of scope specifiers.
bool SuppressUnwrittenScope: 1
 Suppress printing parts of scope specifiers that don't need to be written, e.g., for inline or anonymous namespaces.
bool SuppressInitializers: 1
 Suppress printing of variable initializers.
bool ConstantArraySizeAsWritten: 1
 Whether we should print the sizes of constant array expressions as written in the sources.
bool AnonymousTagLocations: 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.
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 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 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. For use in Microsoft mode when wchar_t is not available.
unsigned IncludeNewlines: 1
 When true, include newlines after statements like "break", etc.

Detailed Description

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

Definition at line 35 of file PrettyPrinter.h.


Constructor & Destructor Documentation

Create a default printing policy for C.

Definition at line 37 of file PrettyPrinter.h.


Member Data Documentation

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.

Definition at line 130 of file PrettyPrinter.h.

Referenced by getCompletionPrintingPolicy().

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).

Definition at line 142 of file PrettyPrinter.h.

Referenced by clang::BuiltinType::getName(), clang::Sema::getPrintingPolicy(), and clang::DeclSpec::getSpecifierName().

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

This flag is determines whether arrays 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 125 of file PrettyPrinter.h.

When true, print the half-precision floating-point type as 'half' instead of '__fp16'.

Definition at line 158 of file PrettyPrinter.h.

Referenced by clang::BuiltinType::getName().

When true, include newlines after statements like "break", etc.

Definition at line 165 of file PrettyPrinter.h.

The number of spaces to use to indent each line.

Definition at line 51 of file PrettyPrinter.h.

What language we're printing.

Definition at line 48 of file PrettyPrinter.h.

When true, print the built-in wchar_t type as __wchar_t. For use in Microsoft mode when wchar_t is not available.

Definition at line 162 of file PrettyPrinter.h.

Referenced by clang::BuiltinType::getName(), and clang::DeclSpec::getSpecifierName().

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

Definition at line 154 of file PrettyPrinter.h.

Suppress printing of variable initializers.

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

 for (auto x : coll)

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

Definition at line 107 of file PrettyPrinter.h.

When true, suppress printing of lifetime qualifier in ARC.

Definition at line 138 of file PrettyPrinter.h.

Suppresses printing of scope specifiers.

Definition at line 90 of file PrettyPrinter.h.

Referenced by clang::NestedNameSpecifier::print().

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:

 const int *x, *y;

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 67 of file PrettyPrinter.h.

Referenced by clang::Decl::printGroup().

When true, suppress printing of the __strong lifetime qualifier in ARC.

Definition at line 134 of file PrettyPrinter.h.

Referenced by getCompletionPrintingPolicy(), clang::TemplateArgument::print(), and rewriteToObjCProperty().

Whether type printing should skip printing the actual tag type.

This is used when the caller needs to print a tag definition in front of the type, as in constructs like the following:

 typedef struct { int x, y; } Point;

Definition at line 87 of file PrettyPrinter.h.

Referenced by clang::Decl::printGroup().

Whether type printing should skip printing the tag keyword.

This is used when printing the inner type of elaborated types, (as the tag keyword is part of the elaborated type):

 struct Geometry::Point;

Definition at line 77 of file PrettyPrinter.h.

Suppress printing parts of scope specifiers that don't need to be written, e.g., for inline or anonymous namespaces.

Definition at line 94 of file PrettyPrinter.h.

Referenced by getCompletionPrintingPolicy(), and clang::NamedDecl::printQualifiedName().

Provide a 'terse' output.

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.

Definition at line 149 of file PrettyPrinter.h.

Referenced by clang::LocationContext::dumpStack().


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