[clang] [AST] Add dump() method to TypeLoc (PR #65484)

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 11 12:34:40 PDT 2023


================
@@ -223,6 +238,22 @@ void JSONNodeDumper::Visit(const APValue &Value, QualType Ty) {
   JOS.attribute("value", OS.str());
 }
 
+void JSONNodeDumper::Visit(const ConceptReference *CR) {
+  JOS.attribute("kind", "ConceptReference");
+  JOS.attribute("id", createPointerRepresentation(CR->getNamedConcept()));
+  if (const auto *Args = CR->getTemplateArgsAsWritten()) {
+    JOS.attributeArray("templateArgsAsWritten", [Args, this] {
+      for (const TemplateArgumentLoc &TAL : Args->arguments())
+        JOS.object(
+            [&TAL, this] { Visit(TAL.getArgument(), TAL.getSourceRange()); });
+    });
+  }
+  JOS.attributeObject("loc",
+                      [CR, this] { writeSourceLocation(CR->getLocation()); });
+  JOS.attributeObject("range",
+                      [CR, this] { writeSourceRange(CR->getSourceRange()); });
+}
+
----------------
sam-mccall wrote:

Added to the PR description.
(It is indeed required, and it seems correct that it's required, so I won't worry much that I'm not sure *exactly* what triggered the need for it)

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


More information about the cfe-commits mailing list