summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/YAMLTraits.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [YAML] Fix YAML tags appearing before the start of sequence elementsChris Bieneman2016-06-281-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Our existing yaml::Output code writes tags immediately when mapTag is called, without any state handling. This results in tags on sequence elements being written before the element itself. For example, we see this: SomeArray: !elem_type - key1: 1 key2: 2 !elem_type2 - key3: 3 key4: 4 We should instead see: SomeArray: - !elem_type key1: 1 key2: 2 - !elem_type2 key3: 3 key4: 4 Our reader handles reading properly, so this bug only impacts writing yaml sequences with tagged elements. As a test for this I've modified the Mach-O yaml encoding to allways apply the !mach-o tag when encoding MachOYAML::Object entries. This results in the !mach-o tag appearing as expected in dumped fat files. llvm-svn: 274067
* [YAMLTraits] Use StringRef::copy. No functionality change.Benjamin Kramer2015-08-051-12/+4
| | | | llvm-svn: 244044
* [YAMLIO] Make line-wrapping configurable and test it.Frederic Riss2015-05-291-3/+4
| | | | | | | | | | | | | | | | Summary: We would wrap flow mappings and sequences when they go over a hardcoded 70 characters limit. Make the wrapping column configurable (and default to 70 co the change should be NFC for current users). Passing 0 allows to completely suppress the wrapping which makes it easier to handle in tools like FileCheck. Reviewers: bogner Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10109 llvm-svn: 238584
* Resubmit r237954 (MIR Serialization: print and parse LLVM IR using MIR format).Alex Lorenz2015-05-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit a 3rd attempt at comitting the initial MIR serialization patch. The first commit (r237708) was reverted in 237730. Then the second commit (r237954) was reverted in r238007, as the MIR library under CodeGen caused a circular dependency where the CodeGen library depended on MIR and MIR library depended on CodeGen. This commit has fixed the dependencies between CodeGen and MIR by reorganizing the MIR serialization code - the code that prints out MIR has been moved to CodeGen, and the MIR library has been renamed to MIRParser. Now the CodeGen library doesn't depend on the MIRParser library, thus the circular dependency no longer exists. --Original Commit Message-- MIR Serialization: print and parse LLVM IR using MIR format. This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 238341
* Revert r237954, "Resubmit r237708 (MIR Serialization: print and parse LLVM ↵NAKAMURA Takumi2015-05-221-4/+0
| | | | | | | | IR using MIR format)." It brought cyclic dependencies between LLVMCodeGen and LLVMMIR. llvm-svn: 238007
* Resubmit r237708 (MIR Serialization: print and parse LLVM IR using MIR format).Alex Lorenz2015-05-211-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a 2nd attempt at committing the initial MIR serialization patch. The first commit (r237708) made the incremental buildbots unstable and was reverted in r237730. The original commit didn't add a terminating null character to the LLVM IR source which was passed to LLParser, and this sometimes caused the test 'llvmIR.mir' to fail with a parsing error because the LLVM IR source didn't have a null character immediately after the end and thus LLLexer encountered some garbage characters that ultimately caused the error. This commit also includes the other test fixes I committed in r237712 (llc path fix) and r237723 (remove target triple) which also got reverted in r237730. --Original Commit Message-- MIR Serialization: print and parse LLVM IR using MIR format. This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 237954
* Revert r237708 (MIR serialization) - incremental buildbots became unstable.Alex Lorenz2015-05-191-4/+0
| | | | | | | | The incremental buildbots entered a pass-fail cycle where during the fail cycle one of the tests from this commit fails for an unknown reason. I have reverted this commit and will investigate the cause of this problem. llvm-svn: 237730
* MIR Serialization: print and parse LLVM IR using MIR format.Alex Lorenz2015-05-191-0/+4
| | | | | | | | | | | | | | | | This commit is the initial commit for the MIR serialization project. It creates a new library under CodeGen called 'MIR'. This new library adds a new machine function pass that prints out the LLVM IR using the MIR format. This pass is then added as a last pass when a 'stop-after' option is used in llc. The new library adds the initial functionality for parsing of MIR files as well. This commit also extends the llc tool so that it can recognize and parse MIR input files. Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames Differential Revision: http://reviews.llvm.org/D9616 llvm-svn: 237708
* YAML: Add support for literal block scalar I/O.Alex Lorenz2015-05-141-0/+26
| | | | | | | | | | | | | This commit gives the users of the YAML Traits I/O library the ability to serialize scalars using the YAML literal block scalar notation by allowing them to implement a specialization of the `BlockScalarTraits` struct for their custom types. Reviewers: Duncan P. N. Exon Smith Differential Revision: http://reviews.llvm.org/D9613 llvm-svn: 237404
* Revert r237157, "YAML: Fix typos. NFC".Alex Lorenz2015-05-121-2/+2
| | | | | | 'Iff' isn't a typo, it's a shorthand for 'if and only if'. llvm-svn: 237160
* YAML: Fix typos. NFC.Alex Lorenz2015-05-121-2/+2
| | | | llvm-svn: 237157
* YAML: Add an optional 'flow' field to the mapping trait to allow flow ↵Alex Lorenz2015-05-041-4/+46
| | | | | | | | | | | | | mapping output. This patch adds an optional 'flow' field to the MappingTrait class so that yaml IO will be able to output flow mappings. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9450 llvm-svn: 236456
* YAML: Fix the output of sequences that contain flow sequences. Alex Lorenz2015-05-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | This patch fixes a bug where the YAML Output class emitted a sequence of flow sequences without the '-' characters. Before: seq: [ a, b ] [ c, d ] After: seq: - [ a, b ] - [ c, d ] Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9206 llvm-svn: 236329
* Purge unused includes throughout libSupport.Benjamin Kramer2015-03-231-2/+3
| | | | | | NFC. llvm-svn: 232976
* Detect malformed YAML sequence in yaml::Input::beginSequence()Justin Bogner2015-03-021-7/+10
| | | | | | | | | | | | | | | | | | | | | When reading a yaml::SequenceTraits object, YAMLIO does not report an error if the yaml item is not a sequence. Instead, YAMLIO reads an empty sequence. For example: --- seq: foo: 1 bar: 2 ... If `seq` is a SequenceTraits object, then reading the above yaml will yield `seq` as an empty sequence. Fix this to report an error for the above mapping ("not a sequence") Patch by William Fisher. Thanks! llvm-svn: 230976
* Remove trailing whitespace. NFC ®Alex Rosenberg2015-01-261-1/+1
| | | | llvm-svn: 227105
* [YAMLIO] Add support for numeric values in enums.Michael J. Spencer2015-01-231-0/+14
| | | | llvm-svn: 226942
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-141-1/+1
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Fix memory leak in error paths in YAMLTraits by using unique_ptrDavid Blaikie2014-09-151-31/+21
| | | | | | | | | There's some other cleanup that could happen here, but this is at least the mechanical transformation to unique_ptr. Derived from a patch by Anton Yartsev. llvm-svn: 217803
* Fix bug 20125 - clang-format segfaults on bad config.Rafael Espindola2014-08-081-1/+6
| | | | | | | The problem was in unchecked dyn_cast inside of Input::createHNodes. Patch by Roman Kashitsyn! llvm-svn: 215205
* Finishing touch for the std::error_code transition.Rafael Espindola2014-06-131-3/+4
| | | | | | | | | | | While std::error_code itself seems to work OK in all platforms, there are few annoying differences with regards to the std::errc enumeration. This patch adds a simple llvm enumeration, which will hopefully avoid build breakages in other platforms and surprises as we get more uses of std::error_code. llvm-svn: 210920
* Remove 'using std::errro_code' from lib.Rafael Espindola2014-06-131-4/+1
| | | | llvm-svn: 210871
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* Don't import make_error_code into the llvm namespace.Rafael Espindola2014-06-121-3/+3
| | | | llvm-svn: 210772
* Use std::error_code instead of llvm::error_code.Rafael Espindola2014-06-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea of this patch is to turn llvm/Support/system_error.h into a transitional header that just brings in the erorr_code api to the llvm namespace. I will remove it shortly afterwards. The cases where the general idea needed some tweaking: * std::errc is a namespace in msvc, so we cannot use "using std::errc". I could add an #ifdef, but there were not that many uses, so I just added std:: to them in this patch. * Template specialization had to be moved to the std namespace in this patch set already. * The msvc implementation of default_error_condition doesn't seem to provide the same transformations as we need. Not too surprising since the standard doesn't actually say what "equivalent" means. I fixed the problem by keeping our old mapping and using it at error_code construction time. Despite these shortcomings I think this is still a good thing. Some reasons: * The different implementations of system_error might improve over time. * It removes 925 lines of code from llvm already. * It removes 6313 bytes from the text segment of the clang binary when it is built with gcc and 2816 bytes when building with clang and libstdc++. llvm-svn: 210687
* [yaml2obj] Add new command line option `-docnum`.Simon Atanasyan2014-05-311-2/+2
| | | | | | | | | | Input YAML file might contain multiple object file definitions. New option `-docnum` allows to specify an ordinal number (starting from 1) of definition used for an object file generation. Patch reviewed by Sean Silva. llvm-svn: 209967
* YAMLIO: Allow scalars to dictate quotation rulesDavid Majnemer2014-04-101-10/+4
| | | | | | | Introduce ScalarTraits::mustQuote which determines whether or not a StringRef needs quoting before it is acceptable to output. llvm-svn: 205955
* Use range-based for loops. No functionality change.Simon Atanasyan2014-04-101-25/+16
| | | | llvm-svn: 205953
* Revert "Revert "YAMLIO: Encode ambiguous hex strings explicitly""David Majnemer2014-04-091-1/+2
| | | | | | | | | Don't quote octal compatible strings if they are only two wide, they aren't ambiguous. This reverts commit r205857 which reverted r205857. llvm-svn: 205914
* Revert "YAMLIO: Encode ambiguous hex strings explicitly"Filipe Cabecinhas2014-04-091-4/+1
| | | | | | | | This reverts commit r205839. It broke several tests in lld. llvm-svn: 205857
* YAMLIO: Encode ambiguous hex strings explicitlyDavid Majnemer2014-04-091-1/+4
| | | | | | | | | | YAMLIO would turn a BinaryRef into the string 0000000004000000. However, the leading zero causes parsers to interpret it as being an octal number instead of a hexadecimal one. Instead, escape such strings as needed. llvm-svn: 205839
* [C++11] Make use of 'nullptr' in the Support library.Craig Topper2014-04-071-2/+2
| | | | llvm-svn: 205697
* Re-sort all of the includes with ./utils/sort_includes.py so thatChandler Carruth2014-01-071-1/+1
| | | | | | | | | | subsequent changes are easier to review. About to fix some layering issues, and wanted to separate out the necessary churn. Also comment and sink the include of "Windows.h" in three .inc files to match the usage in Memory.inc. llvm-svn: 198685
* revert r194655Nick Kledzik2013-11-211-2/+2
| | | | llvm-svn: 195285
* YAML I/O - Added default trait support for std:string. Making another ↵John Thompson2013-11-191-0/+11
| | | | | | attempt at this, this time doing a clean build on Linux, and running the LLVM, clang, and extra tests, to try to make sure there's no problems. llvm-svn: 195134
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-191-0/+5
| | | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. The memory leaks in this version have been fixed. Thanks Alexey for pointing them out. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy llvm-svn: 195064
* Recover gracefully when deserializing invalid YAML input.Alexander Kornienko2013-11-181-7/+26
| | | | | | | | | Fixes http://llvm.org/PR16221, http://llvm.org/PR15927 Phabricator: http://llvm-reviews.chandlerc.com/D1236 Patch by Andrew Tulloch! llvm-svn: 195016
* Revert r194865 and r194874.Alexey Samsonov2013-11-181-7/+0
| | | | | | | | | | | | This change is incorrect. If you delete virtual destructor of both a base class and a subclass, then the following code: Base *foo = new Child(); delete foo; will not cause the destructor for members of Child class. As a result, I observe plently of memory leaks. Notable examples I investigated are: ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl. llvm-svn: 194997
* [weak vtables] Remove a bunch of weak vtablesJuergen Ributzka2013-11-151-0/+7
| | | | | | | | | | | This patch removes most of the trivial cases of weak vtables by pinning them to a single object file. Differential Revision: http://llvm-reviews.chandlerc.com/D2068 Reviewed by Andy llvm-svn: 194865
* yaml::Input::mapTag(): Don't use StringRef to hold return type of std::string.NAKAMURA Takumi2013-11-141-1/+1
| | | | llvm-svn: 194681
* Whitespace.NAKAMURA Takumi2013-11-141-1/+1
| | | | llvm-svn: 194680
* Add dyn_cast<> support to YAML I/O's IO classNick Kledzik2013-11-141-2/+2
| | | | llvm-svn: 194655
* Add simple support for tags in YAML I/ONick Kledzik2013-11-141-0/+18
| | | | llvm-svn: 194644
* Reverting my r193344 checkin due to build breakage.John Thompson2013-10-241-11/+0
| | | | llvm-svn: 193350
* Added std::string as a built-in type for mapping.John Thompson2013-10-241-0/+11
| | | | llvm-svn: 193344
* Re-submit r190469: YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-111-2/+14
| | | | llvm-svn: 190485
* Revert "YAMLIO: Fix string quoting logic." (r190469)Hans Wennborg2013-09-111-10/+2
| | | | | | It was turning the buildbots red. llvm-svn: 190480
* Remove trailing whitespaceRui Ueyama2013-09-111-5/+4
| | | | llvm-svn: 190472
* YAMLIO: Fix string quoting logic.Rui Ueyama2013-09-111-2/+10
| | | | | | | | YAMLIO printed a string as is without quotes unless it contains a newline character. That did not suffice. We also need to quote a string if it starts with a backquote, quote, double quote or atsign, or it's the empty string. llvm-svn: 190469
* Tighten up the yamilizer so it stops eliding empty sequences if the embedded ↵Aaron Ballman2013-08-151-0/+17
| | | | | | | | empty sequence is the first key/value in a map which is itself in a sequence. Patch with help from Nick Kledzik. llvm-svn: 188508
OpenPOWER on IntegriCloud