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

unsigned Indentation: 8
 The number of spaces to use to indent each line.
LangOptions LangOpts
 What language we're printing.
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 Dump: 1
 True when we are "dumping" rather than "pretty-printing", where dumping involves printing the internal details of the AST and pretty-printing involves printing something similar to source code.
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 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).

Detailed Description

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

Definition at line 34 of file PrettyPrinter.h.


Constructor & Destructor Documentation

clang::PrintingPolicy::PrintingPolicy ( const LangOptions LO) [inline]

Create a default printing policy for C.

Definition at line 36 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 133 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 141 of file PrettyPrinter.h.

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

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

True when we are "dumping" rather than "pretty-printing", where dumping involves printing the internal details of the AST and pretty-printing involves printing something similar to source code.

Definition at line 110 of file PrettyPrinter.h.

Referenced by clang::Stmt::printPretty().

The number of spaces to use to indent each line.

Definition at line 45 of file PrettyPrinter.h.

What language we're printing.

Definition at line 48 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 104 of file PrettyPrinter.h.

Suppresses printing of scope specifiers.

Definition at line 87 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 64 of file PrettyPrinter.h.

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

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

Definition at line 137 of file PrettyPrinter.h.

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

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 84 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 74 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 91 of file PrettyPrinter.h.

Referenced by getCompletionPrintingPolicy().


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