[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,193 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From 741dce551684ee5818262ba3f4618ffcfa70a0d6 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/7] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Erick Velez via cfe-commits
https://github.com/evelez7 edited https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Erick Velez via cfe-commits
@@ -0,0 +1,193 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Erick Velez via cfe-commits
https://github.com/evelez7 edited https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Erick Velez via cfe-commits
https://github.com/evelez7 edited https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Erick Velez via cfe-commits
@@ -0,0 +1,193 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Paul Kirth via cfe-commits
https://github.com/ilovepi deleted https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,193 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-09 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,175 @@ +#include "ClangDocTest.h" +#include "Generators.h" +#include "Representation.h" +#include "gtest/gtest.h" + +namespace clang { +namespace doc { + +static std::unique_ptr getJSONGenerator() { + auto G = doc::findGeneratorByName("json"); + if (!G) +return nu

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-08 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From 741dce551684ee5818262ba3f4618ffcfa70a0d6 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/7] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-08 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From 741dce551684ee5818262ba3f4618ffcfa70a0d6 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/7] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-08 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-07 Thread Petr Hosek via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From 806c2c1f1846879f0217398f81f36a8e49447bdf Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/6] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra Author: Erick Velez (evelez7) Changes Adds a JSON generator backend to emit mapped information as JSON. This will enable a better testing format for upcoming changes. It can also potentially serve to feed our other backend generators

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Paul Kirth via cfe-commits
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
https://github.com/evelez7 ready_for_review https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Petr Hosek via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- clang-tools-extra/clang-doc/JSONGenerator.cpp clan

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Petr Hosek via cfe-commits
@@ -0,0 +1,194 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct Foo; + +// This is a nice class. +// It has some nice methods and fields. +// @brief This is

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From fa8b80f9bfe2b7faf765ed4cf60fb8cec30e1d48 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/5] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,40 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --output=%t --format=json --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.json + +struct MyClass { + template T methodTemplate(T param) { + } +}; + +// CHECK: "PublicFunct

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From fa8b80f9bfe2b7faf765ed4cf60fb8cec30e1d48 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/5] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,430 @@ +#include "Generators.h" +#include "clang/Basic/Specifiers.h" +#include "llvm/Support/JSON.h" + +using namespace llvm; +using namespace llvm::json; + +namespace clang { +namespace doc { + +class JSONGenerator : public Generator { +public: + static const char *Fo

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Paul Kirth via cfe-commits
https://github.com/ilovepi approved this pull request. I think this is a good start, modulo a couple fixes on reserving space in json::Arrays. I'm fine if we keep incrementally adding testing rather than doing it all up front. When we're done I imagine most of the YAML tests can be converted,

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,430 @@ +#include "Generators.h" +#include "clang/Basic/Specifiers.h" +#include "llvm/Support/JSON.h" + +using namespace llvm; +using namespace llvm::json; + +namespace clang { +namespace doc { + +class JSONGenerator : public Generator { +public: + static const char *Fo

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From fa8b80f9bfe2b7faf765ed4cf60fb8cec30e1d48 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/4] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-06 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From fa8b80f9bfe2b7faf765ed4cf60fb8cec30e1d48 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/4] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-05 Thread Paul Kirth via cfe-commits
ilovepi wrote: > > This sounds promising. I'm fine w/ adding a field to track this. BTW, what > > does clang do? I'm wondering if we should track more than 1-bit of info > > here. > > As far as I can tell, inside the AST Clang makes use of the `isa<>` > mechanisms (which we could also leverag

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-05 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From fa8b80f9bfe2b7faf765ed4cf60fb8cec30e1d48 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/3] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-05 Thread Erick Velez via cfe-commits
evelez7 wrote: > This sounds promising. I'm fine w/ adding a field to track this. BTW, what > does clang do? I'm wondering if we should track more than 1-bit of info here. As far as I can tell, inside the AST Clang makes use of the `isa<>` mechanisms (which we could also leverage) or pointer u

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-04 Thread Paul Kirth via cfe-commits
ilovepi wrote: > If we're open to adding a flag in the base `Info` like > `IsClassSpecialization`, then we can probably easily deal with these by > trying to reconstruct the specialization's arguments (will be something like > "Foo.json"). Functions don't produce their own files so function >

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-04 Thread Erick Velez via cfe-commits
evelez7 wrote: If we're open to adding a flag in the base `Info` like `IsClassSpecialization`, then we can probably easily deal with these by trying to reconstruct the specialization's arguments (will be something like "Foo.json"). Functions don't produce their own files so function specializa

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
ilovepi wrote: > Right now, since I just ripped the Mustache generator code, it creates > folders for each namespace and emits the nested entities there. This actually > represents a problem for template specializations because the code tries to > write another JSON object (the specialization

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
ilovepi wrote: > I'll investigate this. Although right off the bat, the names in the Infos > aren't mangled. `Name` and `FullName` are the same for both records, which is > unfortunate. OK, well, let's give it a try, and if its too hard lets ... IDK go w/ the YAML thing, so its correct? Test

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Erick Velez via cfe-commits
evelez7 wrote: > This is a good start, but I thin we'll want some more tests, and probably > some unit test coverage. Unittesting is especially nice, since I believe this > backend doesn't need any of the asset files, right? Yeah, this doesn't need assets, so I'll be able to call things direct

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,352 @@ +#include "Generators.h" +#include "llvm/Support/JSON.h" + +using namespace llvm; +using namespace llvm::json; + +static llvm::ExitOnError ExitOnErr; + +namespace clang { +namespace doc { + +class JSONGenerator : public Generator { +public: + static const char *

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,352 @@ +#include "Generators.h" +#include "llvm/Support/JSON.h" + +using namespace llvm; +using namespace llvm::json; + +static llvm::ExitOnError ExitOnErr; + +namespace clang { +namespace doc { + +class JSONGenerator : public Generator { +public: + static const char *

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,352 @@ +#include "Generators.h" +#include "llvm/Support/JSON.h" + +using namespace llvm; +using namespace llvm::json; + +static llvm::ExitOnError ExitOnErr; + +namespace clang { +namespace doc { + +class JSONGenerator : public Generator { +public: + static const char *

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
@@ -0,0 +1,352 @@ +#include "Generators.h" +#include "llvm/Support/JSON.h" + +using namespace llvm; +using namespace llvm::json; + +static llvm::ExitOnError ExitOnErr; + +namespace clang { +namespace doc { + +class JSONGenerator : public Generator { +public: + static const char *

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
https://github.com/ilovepi commented: This is a good start, but I thin we'll want some more tests, and probably some unit test coverage. Unittesting is especially nice, since I believe this backend doesn't need any of the asset files, right? As for whether this should follow the pattern of YAM

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Paul Kirth via cfe-commits
https://github.com/ilovepi edited https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-03 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From fa8b80f9bfe2b7faf765ed4cf60fb8cec30e1d48 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH 1/2] [clang-doc] add a JSON generator --- clang-tools-extra/clang-

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-02 Thread Erick Velez via cfe-commits
https://github.com/evelez7 updated https://github.com/llvm/llvm-project/pull/142483 >From cf68952c0cf4dfeda65c78c6d2326426bbf2d693 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH] [clang-doc] add a JSON generator --- clang-tools-extra/clang-doc/

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-02 Thread Erick Velez via cfe-commits
evelez7 wrote: I think this patch is mostly ready in terms of functionality, but we should decide if the emitted files should follow the HTML or YAML style of creation. Right now, since I just ripped the Mustache generator code, it creates folders for each namespace and emits the nested entiti

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-02 Thread Erick Velez via cfe-commits
https://github.com/evelez7 edited https://github.com/llvm/llvm-project/pull/142483 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-02 Thread Erick Velez via cfe-commits
evelez7 wrote: * **#142483** https://app.graphite.dev/github/pr/llvm/llvm-project/142483?utm_source=stack-comment-icon"; target="_blank">https://static.graphite.dev/graphite-32x32-black.png"; alt="Graphite" width="10px" height="10px"/> 👈 https://app.graphite.dev/github/pr/llvm/llvm-project/1424

[clang-tools-extra] [clang-doc] add a JSON generator (PR #142483)

2025-06-02 Thread Erick Velez via cfe-commits
https://github.com/evelez7 created https://github.com/llvm/llvm-project/pull/142483 None >From 497637bbc1c5b20fb60357fbbfda55514a8681c2 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Mon, 2 Jun 2025 12:53:36 -0700 Subject: [PATCH] [clang-doc] add a JSON generator --- clang-tools-extra/clan