[clang] d31dfc3 - DebugInfo: Unify some printing policy adjustments

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 21 19:30:29 PDT 2021


Author: David Blaikie
Date: 2021-09-21T19:30:12-07:00
New Revision: d31dfc30115705332034a81b6b2ab904ca1cf029

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

LOG: DebugInfo: Unify some printing policy adjustments

Added: 
    

Modified: 
    clang/lib/CodeGen/CGDebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 00ed07ae2fc3c..37d53dfbc7014 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -243,6 +243,9 @@ PrintingPolicy CGDebugInfo::getPrintingPolicy() const {
     PP.SplitTemplateClosers = true;
   }
 
+  PP.SuppressInlineNamespace = false;
+  PP.PrintCanonicalTypes = true;
+
   // Apply -fdebug-prefix-map.
   PP.Callbacks = &PrintCB;
   return PP;
@@ -4850,12 +4853,8 @@ llvm::DIGlobalVariableExpression *CGDebugInfo::CollectAnonRecordDecls(
 std::string CGDebugInfo::GetName(const Decl *D, bool Qualified) const {
   std::string Name;
   llvm::raw_string_ostream OS(Name);
-  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
-    PrintingPolicy PP = getPrintingPolicy();
-    PP.PrintCanonicalTypes = true;
-    PP.SuppressInlineNamespace = false;
-    ND->getNameForDiagnostic(OS, PP, Qualified);
-  }
+  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
+    ND->getNameForDiagnostic(OS, getPrintingPolicy(), Qualified);
   return Name;
 }
 


        


More information about the cfe-commits mailing list