[clang] [AST] Only dump desugared type when visibly different (PR #65214)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 07:01:31 PDT 2023


================
@@ -677,13 +677,18 @@ void TextNodeDumper::dumpBareType(QualType T, bool Desugar) {
   ColorScope Color(OS, ShowColors, TypeColor);
 
   SplitQualType T_split = T.split();
-  OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'";
+  std::string T_str = QualType::getAsString(T_split, PrintPolicy);
+  OS << "'" << T_str << "'";
 
   if (Desugar && !T.isNull()) {
-    // If the type is sugared, also dump a (shallow) desugared type.
+    // If the type is sugared, also dump a (shallow) desugared type when
+    // visibly different.
----------------
AaronBallman wrote:

Either approach is grammatically correct, this seems likely to be more about readability for ESL folks. I'm slightly in favor of the change, but don't have a strong opinion (If @cor3ntin thinks it helps readability for him, I think we should make the change -- he's French)

https://github.com/llvm/llvm-project/pull/65214


More information about the cfe-commits mailing list