================
@@ -315,12 +315,16 @@ std::string 
JSONNodeDumper::createPointerRepresentation(const void *Ptr) {
 
 llvm::json::Object JSONNodeDumper::createQualType(QualType QT, bool Desugar) {
   SplitQualType SQT = QT.split();
-  llvm::json::Object Ret{{"qualType", QualType::getAsString(SQT, 
PrintPolicy)}};
+  std::string SQTS = QualType::getAsString(SQT, PrintPolicy);
+  llvm::json::Object Ret{{"qualType", SQTS}};
 
   if (Desugar && !QT.isNull()) {
     SplitQualType DSQT = QT.getSplitDesugaredType();
-    if (DSQT != SQT)
-      Ret["desugaredQualType"] = QualType::getAsString(DSQT, PrintPolicy);
+    if (DSQT != SQT) {
+      std::string DSQTS = QualType::getAsString(DSQT, PrintPolicy);
+      if (DSQTS != SQTS)
+        Ret["desugaredQualType"] = DSQTS;
+    }
----------------
AaronBallman wrote:

The aim with the original code was "if the desugared type and the given qual 
type are the same thing, only print one if we've been asked to print 
desugared", and this keeps that same aim, so I think this is reasonable.

That said, I agree with @cor3ntin that this needs a release note because there 
is a change in behavior that may break downstream consumers who expect the 
`desugaredQualType` field that's no longer going to show up for them. I don't 
expect it to be significantly disruptive in practice, but we should explicitly 
communicate that sort of change to users.

https://github.com/llvm/llvm-project/pull/65214
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to