summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-doc
Commit message (Collapse)AuthorAgeFilesLines
* NFC: Fix trivial typos in commentsKazuaki Ishizaki2020-01-044-4/+4
|
* [NFC] Fixes -Wrange-loop-analysis warningsMark de Wever2020-01-011-1/+1
| | | | | | This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71857
* Revert "Use InitLLVM to setup a pretty stack printer"Nico Weber2019-11-251-2/+1
| | | | | | | This reverts commit 3f76260dc0674cc0acb25f550a0f0c594cf537ea. Breaks at least these tests on Windows: Clang :: Driver/clang-offload-bundler.c Clang :: Driver/clang-offload-wrapper.c
* Use InitLLVM to setup a pretty stack printerRui Ueyama2019-11-261-1/+2
| | | | | | | | | | | | | | InitLLVM does not only save a few lines from main() but also makes the commands do the right thing for multibyte character pathnames on Windows (i.e. canonicalize argv's to UTF-8) because of the code we have in this file: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/InitLLVM.cpp#L32 For many LLVM commands, we already have calls of InitLLVM, but there are still remainings. Differential Revision: https://reviews.llvm.org/D70702
* [clang-tools-extra] [cmake] Link against libclang-cpp whenever possibleMichal Gorny2019-10-041-2/+5
| | | | | | | | | Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 llvm-svn: 373786
* [clang-doc] sys::fs::F_None -> OF_None. NFCFangrui Song2019-09-092-3/+3
| | | | | | F_None, F_Text and F_Append are kept for compatibility. llvm-svn: 371394
* Changed FrontendActionFactory::create to return a std::unique_ptrDmitri Gribenko2019-08-291-3/+3
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66947 llvm-svn: 370379
* [clang-doc] Use llvm::createStringError and canonicalize error messagesFangrui Song2019-08-287-109/+99
| | | | | | | | | | | | | "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] Switch Generator::CreateResources to use llvm::ErrorJulie Hockett2019-08-264-28/+44
| | | | | | Differential Revision: https://reviews.llvm.org/D66502 llvm-svn: 369925
* [clang-doc] Bump BitcodeWriter max line number to 32UJulie Hockett2019-08-231-1/+1
| | | | | | | | | PR43039 reports hitting the assert on a very large file, so bumping this to allow for larger files. Differential Revision: https://reviews.llvm.org/D66681 llvm-svn: 369811
* Retire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.Benjamin Kramer2019-08-221-2/+2
| | | | llvm-svn: 369674
* Remove \brief commands from doxygen comments.Dmitri Gribenko2019-08-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done [This is analogous to LLVM r331272 and CFE r331834] Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66578 llvm-svn: 369643
* [clang-doc] Fix casting not working in gcc 5.4.0Diego Astiazaran2019-08-171-4/+4
| | | | | | | | | An implicit cast of std::string to llvm::SmallString<> was breaking GCC 5.4.0 builder. A pair using llvm::SmallString<> now uses std::string. Differential Revision: https://reviews.llvm.org/D66378 llvm-svn: 369182
* [clang-doc] Redesign of generated HTML filesDiego Astiazaran2019-08-166-189/+1074
| | | | | | | | | | | | | The new design includes a header (contains the project name), a main section, and a footer. The main section is divided into three subsections. Left, middle, right. The left section contains the general index, the middle contains the info's data, and the right contains the index for the info's content. The CSS has been updated. A flag --project-name is added. The Attributes attribute of the TagNode struct is now a vector of pairs because these attributes should be rendered in the insertion order. The functions (cpp and js) that converts an Index tree structure into HTML were slightly modified; the first ul tag created is now a ol tag. The inner lists are still ul. Differential Revision: https://reviews.llvm.org/D66353 llvm-svn: 369139
* [clang-doc] Fix records in global namespaceDiego Astiazaran2019-08-161-12/+8
| | | | | | | | | | | | | When a Record is declared in the global namespace, clang-doc serializes it as a child of the global namespace, so the global namespace is now one if its parent namespaces. This namespace was not being included in the list of namespaces of the Info causing paths to be incorrect and the index rendered incorrectly. Affected tests have been fixed. Differential revision: https://reviews.llvm.org/D66298 llvm-svn: 369123
* [clang-doc] Serialize inherited attributes and methodsDiego Astiazaran2019-08-167-35/+255
| | | | | | | | | | | 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
* [clang-doc] Sort index elements case insensitiveDiego Astiazaran2019-08-152-2/+24
| | | | | | | | Implement logic to compare the references of the index case insensitive. Differential revision: https://reviews.llvm.org/D66299 llvm-svn: 369068
* [clang-doc] Fix use of source-root flagDiego Astiazaran2019-08-152-9/+7
| | | | | | | | | | The value, if any, of --source-root flag was not being used. This has been fixed and the logic was moved to the ClangDocContext contructor. Differential revision: https://reviews.llvm.org/D66268 llvm-svn: 369065
* [clang-doc] Fix bitcode writer for access specifiersDiego Astiazaran2019-08-154-7/+17
| | | | | | | | | | | | | | | Bitcode writer was not emitting the corresponding record for the Access attribute of a FunctionInfo. This has been added. AS_none was being used as the default value for any AcesssSpecifier attribute (in FunctionInfo and MemberTypeInfo), this has been changed to AS_public because this is the enum value that evaluates to 0. The bitcode writer doesn't write values that are 0 so if an attribute was set to AS_public, this value is not written and after reading the bitcode it would have the default value which is AS_none. This is why the default value is now AS_public. Differential Revision: https://reviews.llvm.org/D66151 llvm-svn: 369063
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-145-68/+68
| | | | | | | | | | 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
* [clang-doc] Add missing check in testsDiego Astiazaran2019-08-141-0/+7
| | | | | | | | Path is now checked when comparing two Infos in the unit tests. Differential Revision: https://reviews.llvm.org/D66124 llvm-svn: 368912
* [clang-doc] Generate HTML links for children namespaces/recordsDiego Astiazaran2019-08-124-42/+83
| | | | | | | | | | | | | | | | Path is now stored in the references to the child while serializing, then this path is used to generate the relative path in the HTML generator. Now some references have paths and some don't so in the reducing phase, references are now properly merged checking for empty attributes. Tests added for HTML and YAML generators, merging and serializing. computeRelativePath function had a bug when the filepath is part of the given directory; it returned a path that starts with a separator. This has been fixed. Differential Revision: https://reviews.llvm.org/D65987 llvm-svn: 368602
* [clang-doc] Generate an HTML index fileDiego Astiazaran2019-08-091-1/+19
| | | | | | | | | clang-doc now generates a file that contains only an index to all the infos that can be used as the landing page for the generated website. Differential Revision: https://reviews.llvm.org/D65918 llvm-svn: 368484
* [clang-format] Add link to source code in file definitionsDiego Astiazaran2019-08-0910-72/+189
| | | | | | | | | | | | | 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
* [clang-doc] Protect Index with mutex during reducing and generation stageDiego Astiazaran2019-08-081-0/+4
| | | | | | | | | | Idx in ClangDocContext instance was being modified by multiple threads causing a seg fault. A mutex is added to avoid this. Differential Revision: https://reviews.llvm.org/D65915 llvm-svn: 368313
* [clang-doc] Add second index for sections within info's contentDiego Astiazaran2019-08-072-12/+91
| | | | | | | | | | | | This new index contains links to the main section of infos: Namespaces, Records, Functions, Enums, Members. Also to each child function or enum. Index is currently rendered on top of the info content, this will be fixed later with CSS. Depends on D65690. Differential Revision: https://reviews.llvm.org/D65030 llvm-svn: 368209
* [clang-doc] Parallelize reducing phaseDiego Astiazaran2019-08-071-52/+63
| | | | | | | | | | | Reduce phase has been parallelized and a execution time was reduced by 60% with this. The reading of bitcode (bitcode -> Info) was moved to this segment of code parallelized so it now happens just before reducing. Differential Revision: https://reviews.llvm.org/D65628 llvm-svn: 368206
* [clang-doc] Fix paths of js in import tagsDiego Astiazaran2019-08-061-0/+2
| | | | | | | | HTML requires posix-style paths. Differential Revision: https://reviews.llvm.org/D65827 llvm-svn: 368087
* [clang-doc] Add index in each info html fileDiego Astiazaran2019-08-0611-59/+335
| | | | | | | | | | | | An index structure is created while generating the output file for each info. This structure is parsed to JSON and written to a file in the output directory. The html for the index is not rendered by clang-doc. A Javascript file is included in the output directory, this will the JSON file and insert HTML elements into the file. Differential Revision: https://reviews.llvm.org/D65690 llvm-svn: 368070
* [clang-doc] Fix link generationDiego Astiazaran2019-08-066-6/+23
| | | | | | | | | | | | | | | | | | | 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
* Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFCFangrui Song2019-08-051-1/+2
| | | | | | F_{None,Text,Append} are kept for compatibility since r334221. llvm-svn: 367800
* [clang-doc] Add flag to continue after mapping errorsDiego Astiazaran2019-08-021-2/+13
| | | | | | | | | | The tool used to stop execution if there was an error in the mapping phase. It will now show the error but continue with the files that were mapped correctly if the flag is true. Differential revision: https://reviews.llvm.org/D65627 llvm-svn: 367729
* [clang-doc] Fix failing tests on WindowsDiego Astiazaran2019-07-291-0/+2
| | | | | | | | | Tests on Windows were failing due to path separator differences. Links in HTML should use posix-style paths. Differential Revision: https://reviews.llvm.org/D65419 llvm-svn: 367264
* [clang-format] Fix style of css file pathsDiego Astiazaran2019-07-261-0/+2
| | | | | | | | | CSS files included in HTML should have a path in posix style, it should not be different for Windows. Differential Revision: https://reviews.llvm.org/D65309 llvm-svn: 367137
* [clang-doc] Add option for user provided stylesheetsDiego Astiazaran2019-07-256-35/+73
| | | | | | | | | | An option has been added to clang-doc to provide a list of css stylesheets that the user wants to use for the generated html docs. Depends on D64539. Differential Revision: https://reviews.llvm.org/D64938 llvm-svn: 367072
* [clang-doc] Add stylesheet to generated html docsDiego Astiazaran2019-07-259-4/+262
| | | | | | | | A default css stylesheet is included for docs generated in html format. Differential Revision: https://reviews.llvm.org/D64539 llvm-svn: 367056
* [clang-doc] Fix output format of htmlDiego Astiazaran2019-07-251-39/+15
| | | | | | | | | The children of a TagNode are rendered in the same line as the parent only if they are all TextNodes. When children are not inline; two text nodes that are adjacent won't have a new line between them, each tag node is rendered in its own line. Differential Revision: https://reviews.llvm.org/D65005 llvm-svn: 367050
* [clang-doc] Fix html entities in rendered textDiego Astiazaran2019-07-251-1/+2
| | | | | | | | | Replace &, <, >, ", and ' with their corresponding html entities in text rendered by HTML generator. Differential Revision: https://reviews.llvm.org/D65107 llvm-svn: 367045
* [clang-doc] Add html links to referencesJulie Hockett2019-07-1212-154/+327
| | | | | | | | | | | | | | | | <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
* [clang-doc] Silence compiler warning with gcc 7.4 [NFC]Mikael Holmen2019-07-111-0/+3
| | | | | | | | | | | | | | | | | | | | Without the fix gcc 7.4.0 complains with /data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp: In member function 'llvm::SmallString<16> clang::doc::{anonymous}::HTMLTag::ToString() const': /data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp:165:1: error: control reaches end of non-void function [-Werror=return-type] } ^ /data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp: In member function 'bool clang::doc::{anonymous}::HTMLTag::HasInlineChildren() const': /data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp:142:1: error: control reaches end of non-void function [-Werror=return-type] } ^ /data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp: In member function 'bool clang::doc::{anonymous}::HTMLTag::IsSelfClosing() const': /data/repo/master/clang-tools-extra/clang-doc/HTMLGenerator.cpp:126:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1plus: all warnings being treated as errors llvm-svn: 365736
* [clang-doc] Add a structured HTML generatorJulie Hockett2019-07-106-59/+593
| | | | | | | | | | | | | | | Implements an HTML generator. Nodes are used to represent each part of the HTML file. There are TagNodes that represent every HTML tag (p, h1, div, ...) and they have children nodes, which can be TagNodes or TextNodes (these nodes only have text). Proper indentation is rendered within the files generated by tool. No styling (CSS) is included. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com) Differential Revision: https://reviews.llvm.org/D63857 llvm-svn: 365687
* Bitstream reader: Fix undefined behavior seen after rL364464Bjorn Pettersson2019-07-051-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Bitcode] Move Bitstream to a separate libraryFrancis Visoiu Mistrih2019-07-033-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This moves Bitcode/Bitstream*, Bitcode/BitCodes.h to Bitstream/. This is needed to avoid a circular dependency when using the bitstream code for parsing optimization remarks. Since Bitcode uses Core for the IR part: libLLVMRemarks -> Bitcode -> Core and Core uses libLLVMRemarks to generate remarks (see IR/RemarkStreamer.cpp): Core -> libLLVMRemarks we need to separate the Bitstream and Bitcode part. For clang-doc, it seems that it doesn't need the whole bitcode layer, so I updated the CMake to only use the bitstream part. Differential Revision: https://reviews.llvm.org/D63899 llvm-svn: 365091
* [clang-doc] Serialize child namespaces and recordsJulie Hockett2019-07-023-40/+99
| | | | | | | | | | | | Serialization of child namespaces and records is now handled. Namespaces can have child records and child namespaces. Records can only have child records. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D63911 llvm-svn: 364963
* [clang-doc] Fix segfault in comment sortingJulie Hockett2019-07-021-6/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D63962 llvm-svn: 364949
* [clang-doc] Handle anonymous namespacesJulie Hockett2019-06-284-30/+87
| | | | | | | | Improves output for anonymous decls, and updates the '--public' flag to exclude everything under an anonymous namespace. Differential Revision: https://reviews.llvm.org/D52847 llvm-svn: 364674
* [clang-doc] De-duplicate comments and locationsJulie Hockett2019-06-282-0/+54
| | | | | | | | | | | | De-duplicate comments and declaration locations in reduce function. When two files include the same header file, this file's content is mapped twice causing comments and locations to be duplicated after the reduce stage. Committed on behalf of Diego Astiazarán (diegoaat97@gmail.com). Differential Revision: https://reviews.llvm.org/D62970 llvm-svn: 364670
* BitStream reader: propagate errorsJF Bastien2019-06-263-28/+62
| | | | | | | | | | | | | | | | | | | | | | 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
* [clang-doc] Add basic support for templates and typedefJulie Hockett2019-06-245-10/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [clang-doc] Build as clang_toolJulie Hockett2019-03-291-1/+1
| | | | | | | | Instead of as clang_executable. Differential Revision: https://reviews.llvm.org/D59974 llvm-svn: 357274
OpenPOWER on IntegriCloud