summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/SerializedDiagnosticReader.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Bitstream reader: Fix undefined behavior seen after rL364464Bjorn Pettersson2019-07-051-5/+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-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* BitStream reader: propagate errorsJF Bastien2019-06-261-18/+76
| | | | | | | | | | | | | | | | | | | | | | 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
* 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
* [Frontend] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-03-261-9/+22
| | | | | | other minor fixes (NFC). llvm-svn: 328584
* [Frontend] Verify that the bitstream is not empty before readingAlex Lorenz2017-07-071-0/+3
| | | | | | | | | | | | | | the serialised diagnostics Clang should avoid calling report_fatal_error when the file with the serialised diagnostics is empty. This commit changes Clang's serialised diagnostic reader, now it reports an appropriate error instead of crashing. rdar://31939877 Differential Revision: https://reviews.llvm.org/D35069 llvm-svn: 307384
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+1
| | | | llvm-svn: 304645
* Bitcode: Decouple block info block state from reader.Peter Collingbourne2016-11-081-4/+7
| | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html Move block info block state to a new class, BitstreamBlockInfo. Clients may set the block info for a particular cursor with the BitstreamCursor::setBlockInfo() method. At this point BitstreamReader is not much more than a container for an ArrayRef<uint8_t>, so remove it and replace all uses with direct uses of memory buffers. Differential Revision: https://reviews.llvm.org/D26259 llvm-svn: 286207
* Bitcode: Change reader interface to take memory buffers.Peter Collingbourne2016-11-021-4/+1
| | | | | | | | | | | | | | | | | | | As proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106595.html This change also fixes an API oddity where BitstreamCursor::Read() would return zero for the first read past the end of the bitstream, but would report_fatal_error for subsequent reads. Now we always report_fatal_error for all reads past the end. Updated clients to check for the end of the bitstream before reading from it. I also needed to add padding to the invalid bitcode tests in test/Bitcode/. This is because the streaming interface was not checking that the file size is a multiple of 4. Differential Revision: https://reviews.llvm.org/D26219 llvm-svn: 285773
* Use noexcept instead of LLVM_NOEXCEPT now that all compilers support itReid Kleckner2016-10-191-1/+1
| | | | llvm-svn: 284667
* [NFC] Header cleanupMehdi Amini2016-07-181-1/+0
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
* Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.Rafael Espindola2014-11-121-2/+1
| | | | llvm-svn: 221784
* Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer2014-10-261-3/+3
| | | | | | | This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
* Re-apply "Frontend: Extract SerializedDiagnosticReader out of ↵Justin Bogner2014-10-141-0/+296
| | | | | | | | | | | | CXLoadedDiagnostic (NFC)" I'd mispelled "Bitcode/BitCodes.h" before, and tested on a case insensitive filesystem. This reverts commit r219649, effectively re-applying r219647 and r219648. llvm-svn: 219664
* Revert "Frontend: Extract SerializedDiagnosticReader out of ↵Justin Bogner2014-10-141-296/+0
| | | | | | | | | | | CXLoadedDiagnostic (NFC)" The bots can't seem to find an include file. Reverting for now and I'll look into it in a bit. This reverts commits r219647 and r219648. llvm-svn: 219649
* Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)Justin Bogner2014-10-141-0/+296
We currently read serialized diagnostics directly in the C API, which makes it difficult to reuse this logic elsewhere. This extracts the core of the serialized diagnostic parsing logic into a base class that can be subclassed using a visitor pattern. llvm-svn: 219647
OpenPOWER on IntegriCloud