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

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 07:35:23 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()); });
+}
+
----------------
cor3ntin wrote:

This looks almost unrelated, i think it's worth pointing out in the description 

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


More information about the cfe-commits mailing list