[clang] [AST] Only dump desugared type when visibly different (PR #65214)
Jessica Clarke via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 3 14:53:48 PDT 2023
================
@@ -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;
+ }
----------------
jrtc27 wrote:
What's the issue for consumer code? It already needs to handle non-sugar types. And it's not like the type in the JSON is a structured representation of the QualType, it's just a textual dump, so you'd have to go and re-parse it to do anything with it.
https://github.com/llvm/llvm-project/pull/65214
More information about the cfe-commits
mailing list