summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-doc/BitcodeReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clang-doc] Use llvm::createStringError and canonicalize error messagesFangrui Song2019-08-281-83/+73
| | | | | | | | | | | | | "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] Serialize inherited attributes and methodsDiego Astiazaran2019-08-161-0/+43
| | | | | | | | | | | 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-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-141-2/+2
| | | | | | | | | | 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-format] Add link to source code in file definitionsDiego Astiazaran2019-08-091-2/+2
| | | | | | | | | | | | | 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] Fix link generationDiego Astiazaran2019-08-061-0/+2
| | | | | | | | | | | | | | | | | | | 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
* [clang-doc] Add html links to referencesJulie Hockett2019-07-121-1/+7
| | | | | | | | | | | | | | | | <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
* 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
* BitStream reader: propagate errorsJF Bastien2019-06-261-26/+60
| | | | | | | | | | | | | | | | | | | | | | 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-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | 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
* [clang-doc] Explicitly cast to unique_ptrJulie Hockett2018-08-151-1/+1
| | | | | | | Older compilers don't like the implicit cast & move when returning a unique_ptr to an llvm::Expected type. llvm-svn: 339785
* Reland "[clang-doc] Updating BitcodeReader to use llvm::Error""Julie Hockett2018-08-151-200/+247
| | | | | | | With explicit unique_ptr casts so that bots with older compilers don't break. llvm-svn: 339783
* Revert "[clang-doc] Updating BitcodeReader to use llvm::Error"Julie Hockett2018-08-131-247/+200
| | | | | | This reverts commit r339617 for breaking bots. llvm-svn: 339620
* [clang-doc] Updating BitcodeReader to use llvm::ErrorJulie Hockett2018-08-131-200/+247
| | | | llvm-svn: 339617
* Reland "[clang-doc] Refactoring mapper to map by scope"Julie Hockett2018-08-021-12/+73
| | | | | | | | | | | | | | | Relanding with a minor change to prevent an assertion on release bots. The result of this adjusted mapper pass is that all Function and Enum infos are absorbed into the info of their enclosing scope (i.e. the class or namespace in which they are defined). Namespace and Record infos are passed along to the final output, but the second pass creates a reference to each in its parent scope. As a result, the top-level final outputs are Namespaces and Records. Differential Revision: https://reviews.llvm.org/D48341 llvm-svn: 338763
* Revert "[clang-doc] Refactoring mapper to map by scope"Julie Hockett2018-08-021-71/+10
| | | | | | This reverts commit r338738 as it's breaking the bots. llvm-svn: 338748
* [clang-doc] Refactoring mapper to map by scopeJulie Hockett2018-08-021-10/+71
| | | | | | | | | | | The result of this adjusted mapper pass is that all Function and Enum infos are absorbed into the info of their enclosing scope (i.e. the class or namespace in which they are defined). Namespace and Record infos are passed along to the final output, but the second pass creates a reference to each in its parent scope. As a result, the top-level final outputs are Namespaces and Records. llvm-svn: 338738
* [clang-doc] Implement reducer portion of the frontend frameworkJulie Hockett2018-06-041-0/+622
Implements a simple, in-memory reducer for the mapped output of the initial tool. This creates a collection object for storing the deduplicated infos on each declaration, and populates that from the mapper output. The collection object is serialized to LLVM bitstream. On reading each serialized output, it checks to see if a merge is necessary and if so, merges the new info with the existing info (prefering the existing one if conflicts exist). For a more detailed overview of the tool, see the design document on the mailing list: http://lists.llvm.org/pipermail/cfe-dev/2017-December/056203.html Differential Revision: https://reviews.llvm.org/D43341 llvm-svn: 333932
OpenPOWER on IntegriCloud