aboutsummaryrefslogtreecommitdiff
path: root/clang/include/clang/AST/PrettyPrinter.h
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/AST/PrettyPrinter.h')
-rw-r--r--clang/include/clang/AST/PrettyPrinter.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h
index 80eec6a5a8be..616647f44430 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -36,7 +36,9 @@ protected:
public:
/// Remap a path to a form suitable for printing.
- virtual std::string remapPath(StringRef Path) const { return Path; }
+ virtual std::string remapPath(StringRef Path) const {
+ return std::string(Path);
+ }
};
/// Describes how types, statements, expressions, and declarations should be
@@ -55,12 +57,13 @@ struct PrintingPolicy {
SuppressLifetimeQualifiers(false),
SuppressTemplateArgsInCXXConstructors(false), Bool(LO.Bool),
Restrict(LO.C99), Alignof(LO.CPlusPlus11), UnderscoreAlignof(LO.C11),
- UseVoidForZeroParams(!LO.CPlusPlus), TerseOutput(false),
+ UseVoidForZeroParams(!LO.CPlusPlus),
+ SplitTemplateClosers(!LO.CPlusPlus11), TerseOutput(false),
PolishForDeclaration(false), Half(LO.Half),
MSWChar(LO.MicrosoftExt && !LO.WChar), IncludeNewlines(true),
MSVCFormatting(false), ConstantsAsWritten(false),
SuppressImplicitBase(false), FullyQualifiedName(false),
- PrintCanonicalTypes(false) {}
+ PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true) {}
/// 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
@@ -181,6 +184,10 @@ struct PrintingPolicy {
/// with zero parameters.
unsigned UseVoidForZeroParams : 1;
+ /// Whether nested templates must be closed like 'a\<b\<c\> \>' rather than
+ /// 'a\<b\<c\>\>'.
+ unsigned SplitTemplateClosers : 1;
+
/// Provide a 'terse' output.
///
/// For example, in this mode we don't print function bodies, class members,
@@ -237,6 +244,11 @@ struct PrintingPolicy {
/// Whether to print types as written or canonically.
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.
+ unsigned PrintInjectedClassNameWithArguments : 1;
+
/// Callbacks to use to allow the behavior of printing to be customized.
const PrintingCallbacks *Callbacks = nullptr;
};