[libclc] r294916 - Move BufferPtr into the block where it it being used
Jeroen Ketema via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 12 13:33:49 PST 2017
Author: jketema
Date: Sun Feb 12 15:33:49 2017
New Revision: 294916
URL: http://llvm.org/viewvc/llvm-project?rev=294916&view=rev
Log:
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.
Modified:
libclc/trunk/utils/prepare-builtins.cpp
Modified: libclc/trunk/utils/prepare-builtins.cpp
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/utils/prepare-builtins.cpp?rev=294916&r1=294915&r2=294916&view=diff
==============================================================================
--- libclc/trunk/utils/prepare-builtins.cpp (original)
+++ libclc/trunk/utils/prepare-builtins.cpp Sun Feb 12 15:33:49 2017
@@ -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));
More information about the cfe-commits
mailing list