diff options
Diffstat (limited to 'lib/Object/ModuleSummaryIndexObjectFile.cpp')
| -rw-r--r-- | lib/Object/ModuleSummaryIndexObjectFile.cpp | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/lib/Object/ModuleSummaryIndexObjectFile.cpp b/lib/Object/ModuleSummaryIndexObjectFile.cpp index 202783e7d993..11ace84b9ceb 100644 --- a/lib/Object/ModuleSummaryIndexObjectFile.cpp +++ b/lib/Object/ModuleSummaryIndexObjectFile.cpp @@ -22,6 +22,12 @@  using namespace llvm;  using namespace object; +static llvm::cl::opt<bool> IgnoreEmptyThinLTOIndexFile( +    "ignore-empty-index-file", llvm::cl::ZeroOrMore, +    llvm::cl::desc( +        "Ignore an empty index file and perform non-ThinLTO compilation"), +    llvm::cl::init(false)); +  ModuleSummaryIndexObjectFile::ModuleSummaryIndexObjectFile(      MemoryBufferRef Object, std::unique_ptr<ModuleSummaryIndex> I)      : SymbolicFile(Binary::ID_ModuleSummaryIndex, Object), Index(std::move(I)) { @@ -97,6 +103,8 @@ llvm::getModuleSummaryIndexForFile(StringRef Path) {    if (EC)      return errorCodeToError(EC);    MemoryBufferRef BufferRef = (FileOrErr.get())->getMemBufferRef(); +  if (IgnoreEmptyThinLTOIndexFile && !BufferRef.getBufferSize()) +    return nullptr;    Expected<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr =        object::ModuleSummaryIndexObjectFile::create(BufferRef);    if (!ObjOrErr) | 
