[clang] 6512098 - DebugInfo/Printing: Improve name of policy for including types for template arguments

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 11 21:59:35 PST 2021


Author: David Blaikie
Date: 2021-11-11T21:59:27-08:00
New Revision: 6512098877c3a230bbd38bc81b14a4e5844739ff

URL: https://github.com/llvm/llvm-project/commit/6512098877c3a230bbd38bc81b14a4e5844739ff
DIFF: https://github.com/llvm/llvm-project/commit/6512098877c3a230bbd38bc81b14a4e5844739ff.diff

LOG: DebugInfo/Printing: Improve name of policy for including types for template arguments

Feedback from Richard Smith that the policy should be named closer to
the context its used in.

Added: 
    

Modified: 
    clang/include/clang/AST/PrettyPrinter.h
    clang/lib/AST/DeclTemplate.cpp
    clang/lib/CodeGen/CGDebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h
index 38d122db0749..f6816e938f2a 100644
--- a/clang/include/clang/AST/PrettyPrinter.h
+++ b/clang/include/clang/AST/PrettyPrinter.h
@@ -75,7 +75,7 @@ struct PrintingPolicy {
         MSVCFormatting(false), ConstantsAsWritten(false),
         SuppressImplicitBase(false), FullyQualifiedName(false),
         PrintCanonicalTypes(false), PrintInjectedClassNameWithArguments(true),
-        UsePreferredNames(true), UseIntegerTypeSuffixesAlways(false) {}
+        UsePreferredNames(true), AlwaysIncludeTypeForTemplateArgument(false) {}
 
   /// 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
@@ -280,7 +280,7 @@ struct PrintingPolicy {
 
   /// Whether to use type suffixes (eg: 1U) on integral non-type template
   /// parameters.
-  unsigned UseIntegerTypeSuffixesAlways : 1;
+  unsigned AlwaysIncludeTypeForTemplateArgument : 1;
 
   /// Callbacks to use to allow the behavior of printing to be customized.
   const PrintingCallbacks *Callbacks = nullptr;

diff  --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 10f7155fcb96..223f06b9db1c 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -204,7 +204,7 @@ bool TemplateParameterList::hasAssociatedConstraints() const {
 bool TemplateParameterList::shouldIncludeTypeForArgument(
     const PrintingPolicy &Policy, const TemplateParameterList *TPL,
     unsigned Idx) {
-  if (!TPL || Idx >= TPL->size() || Policy.UseIntegerTypeSuffixesAlways)
+  if (!TPL || Idx >= TPL->size() || Policy.AlwaysIncludeTypeForTemplateArgument)
     return true;
   const NamedDecl *TemplParam = TPL->getParam(Idx);
   if (const auto *ParamValueDecl =

diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 1ce56f98e1f0..af651e6f44b7 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -247,7 +247,7 @@ PrintingPolicy CGDebugInfo::getPrintingPolicy() const {
   PP.SuppressInlineNamespace = false;
   PP.PrintCanonicalTypes = true;
   PP.UsePreferredNames = false;
-  PP.UseIntegerTypeSuffixesAlways = true;
+  PP.AlwaysIncludeTypeForTemplateArgument = true;
 
   // Apply -fdebug-prefix-map.
   PP.Callbacks = &PrintCB;


        


More information about the cfe-commits mailing list