Age | Commit message (Collapse) | Author | Files | Lines |
|
This patch contains changes for the JSON generator that will enable compatibility with Mustache templates, like booleans to check for the existence and bounds of arrays to avoid duplication.
|
|
This patch changes JSON file serialization. Now, files are serialized
to a single directory instead of nesting them based on namespaces. The
global namespace retains the "index.json" name.
This solves the problem of class template specializations being serialized to the
same file as its base template. This is also planned as part of
future integration with the Mustache generator which will consume the JSON files.
|
|
VarInfo was missing its addReference specialization. This causes errors
when a VarInfo is inside a namespace that isn't the global namespace.
|
|
Parse friends into a new FriendInfo and serialize them in JSON. We keep track of the friend declaration's template and function information if applicable.
|
|
IsBuiltIn and IsTemplate were being emitted as their default values.
|
|
Reduce boilerplate code in readSubBlock by creating a callable from a higher-order lambda based on the block's add need.
|
|
Visit and map VarDecls to document variables declared in namespace scope.
|
|
Add support for documenting concepts. This handles concepts and constraints on function and class templates.
Atomic constraints are not considered yet. We don't order constraints based on their conjunctive or disjunctive properties.
|
|
LLVM style prefers no default label on fully covered switches to warn if
new enums are added. This patch removes the default label for that
purpose or uses IT_default instead of default if that was the only enum
not covered.
|
|
This patch refactors CommentKind handling in clang-doc by introducing a
strongly typed enum class for better type safety and clarity. It updates
all relevant places, including YAML traits and serialization, to work
with the new enum. Additionally, it enhances the Mustache-based HTML
generation by fully supporting all comment kinds, ensuring accurate
structured rendering of comment blocks. The changes simplify future
maintenance, improve robustness by eliminating unchecked defaults, and
ensure consistency between generators.
Fixes https://github.com/llvm/llvm-project/issues/142083
|
|
This patch re-enables -ftime-trace support in clang-doc. Initial support
in #97644 was reverted, and never relanded. This patch adds back the
command line option, and leverages the RAII tracing infrastructure more
thoroughly.
|
|
This patch adds start and end line numbers to clang-doc. Currently
clang-doc only encodes the start line numbers of records, struct, etc.
This patch adds start and end line number to clang-doc bitcode which is
passed to the generator. This will be used by the mustache backend to
generate line ranges. Based on the orginal patch in #135081.
Co-author: Paul Kirth <paulkirth@google.com>
Co-authored-by: PeterChou1 <peter.chou@mail.utoronto.ca>
|
|
This patch fixes:
clang-tools-extra/clang-doc/BitcodeReader.cpp:47:20: error: unused
function 'decodeRecord' [-Werror,-Wunused-function]
clang-tools-extra/clang-doc/BitcodeReader.cpp:437:31: error: unused
function 'getCommentInfo<std::unique_ptr<clang::doc::CommentInfo>
&>' [-Werror,-Wunused-function]
|
|
Additionally moving the declarations from Generator.cpp
prevents misc-use-internal-linkage warnings from clang-tidy.
We fix those here too, since the static functions are part
of the same diagnostic
|
|
|
|
|
|
clang-doc didn't visit VarDecl, and hence never collected info
from class statics members and functions.
Fixes #59813.
|
|
Part of https://github.com/llvm/llvm-project/issues/101129
This patch adds support for attaching comments to enums for HTML in
clang-doc. It changes the enum generation to table tags where as
perviously we're using lists which is more in line with what other doc
generators are doing. It also gives clang-doc the ability to show user
specified enum values
|
|
This broke the build due to failing some clang-tidy checks:
https://lab.llvm.org/buildbot/#/builders/145/builds/789
|
|
this patches adds ftime-tracing option for clang-doc which was what I
used to profile the performance problems we had with clang-doc
generating the llvm docs.
- ftime-trace produces a time profiler json file called
clang-doc-tracing.json
|
|
This patch fixes:
clang-tools-extra/clang-doc/BitcodeReader.cpp:78:3: error: default
label in switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
|
|
This patch converts TagTypeKind into scoped enum. Among other benefits,
this allows us to forward-declare it where necessary.
|
|
Reads template information from the AST and adds template parameters and
specialization information to the corresponding clang-doc structures.
Add a "QualName" to the Reference struct which includes the full
qualified type name. The Reference object represents a link in the
HTML/MD generators so is based on the unqualified name. But this does
not encode C-V qualifiers or template information that decorate the
name. The new QualName member encodes all of this information and also
makes it easier for the generators or downsteam YAML consumers to
generate the full name (before they had to process the "Path").
In test code that was changed, remove made-up paths to built-in types
like "int". In addition to slightnly cleaning up the code, these types
do not have paths in real execution, and generating incorrect references
to nonexistant data may complicate future changes in the generators.
Convert llvm::Optional to std::optional (YAML library requires this for
the new usage, and this makes everything consistent according to the
llvm::Optional -> std::optional transition).
Differential Revision: https://reviews.llvm.org/D139154
|
|
|
|
Causes a build failure in YAML specializations.
This reverts commit 0f6dbb5f164662c3e6a167a89e7a89f07c60e32b.
|
|
Reads template information from the AST and adds template parameters and
specialization information to the corresponding clang-doc structures.
Add a "QualName" to the Reference struct which includes the full
qualified type name. The Reference object represents a link in the
HTML/MD generators so is based on the unqualified name. But this does
not encode C-V qualifiers or template information that decorate the
name. The new QualName member encodes all of this information and also
makes it easier for the generators or downsteam YAML consumers to
generate the full name (before they had to process the "Path").
In test code that was changed, remove made-up paths to built-in types
like "int". In addition to slightnly cleaning up the code, these types
do not have paths in real execution, and generating incorrect references
to nonexistant data may complicate future changes in the generators.
Differential Revision: https://reviews.llvm.org/D139154
|
|
|
|
Provides an initializer for the TypedefInfo.IsUsing member. Previously
this member was uninitialized and would produce random output.
Adds the Description (code comments) to the bitcode reader/writer.
Previously the typedef/using descriptions were lost during the bitcode
round-trip. Adds a test for this.
Differential Revision: https://reviews.llvm.org/D136638
|
|
Read typedef and "using" type alias declarations and serialize into the
internal structures. Emit this information in the YAML output. The HTML
and MD generators are unchanged.
Separate out the logic to create the parent namespace or record object
and insert the newly created child into it. This logic was previously
duplicated for every "info" type and is now shared.
To help this, a struct containing the child vectors was separated out so
children can be added generically and without having too many templates.
A small change was made to populateParentNamespaces() to allow using
types that aren't themselves DeclContexts (typedefs are the first
example of this).
Differential Revision: https://reviews.llvm.org/D134371
|
|
This reverts commit eed22583fd78d4d657fb70b99e62fbdc1f83b8f9, which
breaks clang build with -Werror.
|
|
Read typedef and "using" type alias declarations and serialize into the internal structures. Emit this information in the YAML output. The HTML and MD generators are unchanged.
Separate out the logic to create the parent namespace or record object and insert the newly created child into it. This logic was previously duplicated for every "info" type and is now shared.
To help this, a struct containing the child vectors was separated out so children can be added generically and without having too many templates.
A small change was made to populateParentNamespaces() to allow using types that aren't themselves DeclContexts (typedefs are the first example of this).
Reviewed By: paulkirth, haowei
Differential Revision: https://reviews.llvm.org/D134371
|
|
The *Info object (for the copy of the AST") constructors had many duplicated variants. Many of the variants seemed to be in an attempt to avoid default arguments. But default arguments are not prohibited and using them allows most of the variants to be removed which improves readability.
Remove the IsInGlobalNamespace flag on a Reference. This is set when the path is empty, and only read once in the HTML generator with the identical condition. The constructor cleanup exposed a problem where this was set to false when the constructor with no path was used, but true when the path was set to empty.
There should be no observable change with the exception that IsInGlobalNamespace is no longer emitted in YAML.
Reviewed By: paulkirth, haowei
Differential Revision: https://reviews.llvm.org/D134235
|
|
Add support for explicitly typed enums:
enum Foo : unsigned { ... };
to the internal representation and to the YAML output.
Add support for getting the value of an enum constant, as well as accessing the original expression that produced it. This changes the YAML output of enums from an array of strings for the enum members to an array of dictionaries. These dictionaries now report the name, value, and original expression.
The markdown and HTML outputs are unchanged, they still output the name from the new enhanced internal schema.
Reviewed By: paulkirth
Differential Revision: https://reviews.llvm.org/D134055
|
|
Adds support for default arguments in the internal representation and reads these values from the source. Implements writing these values to YAML but does not implement this for the HTML or markdown outputs.
Reviewed By: paulkirth
Differential Revision: https://reviews.llvm.org/D133732
|
|
Struct/class data members did not have the comments associated with
them. This adds that information to the MemberTypeInfo class and emits
it in the YAML. This does not update the frontends yet.
Reviewed By: paulkirth
Differential Revision: https://reviews.llvm.org/D131298
|
|
Record is a SmallVector<uint64_t, 1024> - we really need to avoid passing this by value.
Avoid unnecessary big copies, reported by coverity.
|
|
"Bad block found.\n" -> "bad block found"
The lower cased form with no full stop or newline is more common in LLVM
tools.
Reviewed By: juliehockett
Differential Revision: https://reviews.llvm.org/D66783
llvm-svn: 370155
|
|
clang-doc now serializes the inherited attributes and methods, not only the name of the base class.
All inherited are tracked, if B:A and C:B, info of A is included in C.
This data is stored in attribute Bases in a RecordInfo.
Previously tracked inheritance data, stored in Parents and VParents, hasn't been removed to reduce review load.
Differential revision: https://reviews.llvm.org/D66238
llvm-svn: 369075
|
|
Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.
Differential revision: https://reviews.llvm.org/D66259
llvm-svn: 368944
|
|
Two command line options have been added to clang-doc.
--repository=<string> - URL of repository that hosts code; used for links to definition locations.
--source-root=<string> - Directory where processed files are stored. Links to definition locations will only be generated if the file is in this dir.
If the file is in the source-root and a repository options is passed;
a link to the source code will be rendered by the HTML generator.
Differential Revision: https://reviews.llvm.org/D65483
llvm-svn: 368460
|
|
Before making a link to a reference it is required to check that the
reference has a path (eg. primitives won't have paths).
This was done by checking if the path was empty; that worked because
when generating paths the outdirectory was included, so if the path was
assigned it had that outdirectory at least.
The path generation was changed, it's now only the composite of the
namespaces without the outdirectory. So if the info is in the global
namespace the path would be empty and the old check wouldn't work as expected.
A new attribute has been added to the Reference struct that indicates if
the info's parent is the global namespace.
Paths generation now fails if the path is empty and if the info
is not in the global namespace.
Differential Revision: https://reviews.llvm.org/D64958
llvm-svn: 367958
|
|
<a> tags are added for the parents and members of records and return type and
params of functions. The link redirects to the reference's info file.
The directory path where each info file will be saved is now generated in the
serialization phase and stored as an attribute in each Info.
Bitcode writer and reader were modified to handle the new attributes.
Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com).
Differential Revision: https://reviews.llvm.org/D63663
llvm-svn: 365937
|
|
Summary:
After rL364464 the following tests started to fail when
running the clang-doc tests with an ubsan instrumented
build of clang-doc:
Clang Tools :: clang-doc/single-file-public.cpp
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/BitcodeTest.emitEnumInfoBitcode
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/BitcodeTest.emitMethodInfoBitcode
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/BitcodeTest.emitRecordInfoBitcode
Extra Tools Unit Tests :: clang-doc/./ClangDocTests/SerializeTest.emitInfoWithCommentBitcode
We need to check that the read value is in range for being
casted to the llvm::bitc::FixedAbbrevIDs enum, before the
cast in ClangDocBitcodeReader::skipUntilRecordOrBlock.
SerializedDiagnosticReader::skipUntilRecordOrBlock was updated
in the same way.
Reviewers: jfb
Reviewed By: jfb
Subscribers: Bigcheese, vsapsai, bruno, ilya-biryukov, dexonsmith, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D64262
llvm-svn: 365239
|
|
The bitstream reader handles errors poorly. This has two effects:
* Bugs in file handling (especially modules) manifest as an "unexpected end of
file" crash
* Users of clang as a library end up aborting because the code unconditionally
calls `report_fatal_error`
The bitstream reader should be more resilient and return Expected / Error as
soon as an error is encountered, not way late like it does now. This patch
starts doing so and adopting the error handling where I think it makes sense.
There's plenty more to do: this patch propagates errors to be minimally useful,
and follow-ups will propagate them further and improve diagnostics.
https://bugs.llvm.org/show_bug.cgi?id=42311
<rdar://problem/33159405>
Differential Revision: https://reviews.llvm.org/D63518
llvm-svn: 364464
|
|
In serialize::parseBases(...), when a base record is a template
specialization, the specialization was used as the parent. It should be
the base template so there is only one file generated for this record.
When the specialized template is implicitly declared the reference USR
corresponded to the GlobalNamespace's USR, this will now be the base
template's USR.
More information about templates will be added later.
In serialize::emiInfo(RecorDecl*, ...), typedef records were not handled
and the name was empty. This is now handled and a IsTypeDef attribute is
added to RecordInfo struct.
In serialize::emitInfo(CXXMethodDecl*, ...), template specialization is
handled like in serialize::parseBases(...).
Bitcode writer and reader are modified to handle the new attribute of
RecordInfo.
Submitted on behalf of Diego Astiazarán (diegoaat97@gmail.com)
Differential Revision: https://reviews.llvm.org/D63367
llvm-svn: 364222
|
|
to reflect the new license.
We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.
Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.
llvm-svn: 351636
|
|
Older compilers don't like the implicit cast & move when returning a
unique_ptr to an llvm::Expected type.
llvm-svn: 339785
|
|
With explicit unique_ptr casts so that bots with older compilers don't
break.
llvm-svn: 339783
|
|
This reverts commit r339617 for breaking bots.
llvm-svn: 339620
|
|
llvm-svn: 339617
|