[llvm] 01525da - [InstrProf] Fix build error in Correlator class

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 16 15:59:18 PST 2021


Author: Ellis Hoag
Date: 2021-12-16T15:59:12-08:00
New Revision: 01525da853c657f72e275395c20e31bd8a8151aa

URL: https://github.com/llvm/llvm-project/commit/01525da853c657f72e275395c20e31bd8a8151aa
DIFF: https://github.com/llvm/llvm-project/commit/01525da853c657f72e275395c20e31bd8a8151aa.diff

LOG: [InstrProf] Fix build error in Correlator class

For some reason this did not fail to compile for me locally, but did
fail on one of the builders. Here is the error:

https://lab.llvm.org/buildbot/#/builders/58/builds/14969
```
/home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/lib/ProfileData/InstrProfCorrelator.cpp: In static member function ‘static llvm::Expected<std::unique_ptr<llvm::InstrProfCorrelator::Context> > llvm::InstrProfCorrelator::Context::get(std::unique_ptr<llvm::MemoryBuffer>, const llvm::object::ObjectFile&)’:
/home/buildbot/as-builder-4/lld-x86_64-ubuntu-fast/llvm-project/llvm/lib/ProfileData/InstrProfCorrelator.cpp:44:10: error: could not convert ‘C’ from ‘std::unique_ptr<llvm::InstrProfCorrelator::Context>’ to ‘llvm::Expected<std::unique_ptr<llvm::InstrProfCorrelator::Context> >’
   return C;
```

Reviewed By: kyulee

Differential Revision: https://reviews.llvm.org/D115911

Added: 
    

Modified: 
    llvm/lib/ProfileData/InstrProfCorrelator.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/InstrProfCorrelator.cpp b/llvm/lib/ProfileData/InstrProfCorrelator.cpp
index 2a4f7a719c72e..c45efa19c74fd 100644
--- a/llvm/lib/ProfileData/InstrProfCorrelator.cpp
+++ b/llvm/lib/ProfileData/InstrProfCorrelator.cpp
@@ -41,7 +41,7 @@ InstrProfCorrelator::Context::get(std::unique_ptr<MemoryBuffer> Buffer,
   C->CountersSectionStart = CountersSection->getAddress();
   C->CountersSectionEnd = C->CountersSectionStart + CountersSection->getSize();
   C->ShouldSwapBytes = Obj.isLittleEndian() != sys::IsLittleEndianHost;
-  return C;
+  return Expected<std::unique_ptr<Context>>(std::move(C));
 }
 
 llvm::Expected<std::unique_ptr<InstrProfCorrelator>>


        


More information about the llvm-commits mailing list