aboutsummaryrefslogtreecommitdiff
path: root/libclc
diff options
context:
space:
mode:
authorJeroen Ketema <j.ketema@imperial.ac.uk>2017-02-12 21:33:49 +0000
committerJeroen Ketema <j.ketema@imperial.ac.uk>2017-02-12 21:33:49 +0000
commit80d2e8ffc1b2a47956fde628bcf6cc8073fb731a (patch)
tree6321b3b6915cf28caecbab3bf6f4493dcf000038 /libclc
parented98e8d0993fad6f74802ec64a09168c462b734c (diff)
downloadllvm-80d2e8ffc1b2a47956fde628bcf6cc8073fb731a.zip
llvm-80d2e8ffc1b2a47956fde628bcf6cc8073fb731a.tar.gz
llvm-80d2e8ffc1b2a47956fde628bcf6cc8073fb731a.tar.bz2
Move BufferPtr into the block where it it being used
The previous location outside the block would crash prepare-builtins when no the builtins file accidentially not passed on the command line. llvm-svn: 294916
Diffstat (limited to 'libclc')
-rw-r--r--libclc/utils/prepare-builtins.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libclc/utils/prepare-builtins.cpp b/libclc/utils/prepare-builtins.cpp
index c8b1f44..882dadd 100644
--- a/libclc/utils/prepare-builtins.cpp
+++ b/libclc/utils/prepare-builtins.cpp
@@ -36,10 +36,10 @@ int main(int argc, char **argv) {
{
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
MemoryBuffer::getFile(InputFilename);
- std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
- if (std::error_code ec = BufferOrErr.getError())
+ if (std::error_code ec = BufferOrErr.getError()) {
ErrorMessage = ec.message();
- else {
+ } else {
+ std::unique_ptr<MemoryBuffer> &BufferPtr = BufferOrErr.get();
ErrorOr<std::unique_ptr<Module>> ModuleOrErr =
expectedToErrorOrAndEmitErrors(Context,
parseBitcodeFile(BufferPtr.get()->getMemBufferRef(), Context));