diff options
author | Zachary Turner <zturner@google.com> | 2017-03-15 22:18:53 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-15 22:18:53 +0000 |
commit | ea4e60754e0556b0f28be36220354831ae532816 (patch) | |
tree | 31105bdda08b889a66aa69d5921837195ed7e51e /llvm/lib/Support/BinaryStreamWriter.cpp | |
parent | 5545407fa4c1353a212166846fe0cad47a770e67 (diff) | |
download | bcm5719-llvm-ea4e60754e0556b0f28be36220354831ae532816.tar.gz bcm5719-llvm-ea4e60754e0556b0f28be36220354831ae532816.zip |
[pdb] Write the module info and symbol record streams.
Previously we did not have support for writing detailed
module information for each module, as well as the symbol
records. This patch adds support for this, and in doing
so enables the ability to construct minimal PDBs from
just a few lines of YAML. A test is added to illustrate
this functionality.
llvm-svn: 297900
Diffstat (limited to 'llvm/lib/Support/BinaryStreamWriter.cpp')
-rw-r--r-- | llvm/lib/Support/BinaryStreamWriter.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Support/BinaryStreamWriter.cpp b/llvm/lib/Support/BinaryStreamWriter.cpp index 487bcdc5a4d..d60b75642d0 100644 --- a/llvm/lib/Support/BinaryStreamWriter.cpp +++ b/llvm/lib/Support/BinaryStreamWriter.cpp @@ -9,6 +9,7 @@ #include "llvm/Support/BinaryStreamWriter.h" +#include "llvm/Support/BinaryStreamError.h" #include "llvm/Support/BinaryStreamReader.h" #include "llvm/Support/BinaryStreamRef.h" @@ -57,3 +58,11 @@ Error BinaryStreamWriter::writeStreamRef(BinaryStreamRef Ref, uint32_t Length) { } return Error::success(); } + +Error BinaryStreamWriter::padToAlignment(uint32_t Align) { + uint32_t NewOffset = alignTo(Offset, Align); + if (NewOffset > getLength()) + return make_error<BinaryStreamError>(stream_error_code::stream_too_short); + Offset = NewOffset; + return Error::success(); +} |