diff options
Diffstat (limited to 'llvm/tools/llvm-lto/llvm-lto.cpp')
| -rw-r--r-- | llvm/tools/llvm-lto/llvm-lto.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp index f3c6c62d496..84dce23aee2 100644 --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -156,6 +156,10 @@ static cl::opt<bool> RestoreGlobalsLinkage( "restore-linkage", cl::init(false), cl::desc("Restore original linkage of globals prior to CodeGen")); +static cl::opt<bool> CheckHasObjC( + "check-for-objc", cl::init(false), + cl::desc("Only check if the module has objective-C defined in it")); + namespace { struct ModuleInfo { std::vector<bool> CanBeHidden; @@ -714,6 +718,21 @@ int main(int argc, char **argv) { return 0; } + if (CheckHasObjC) { + for (auto &Filename : InputFilenames) { + ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = + MemoryBuffer::getFile(Filename); + error(BufferOrErr, "error loading file '" + Filename + "'"); + auto Buffer = std::move(BufferOrErr.get()); + LLVMContext Ctx; + if (llvm::isBitcodeContainingObjCCategory(*Buffer, Ctx)) + outs() << "Bitcode " << Filename << " contains ObjC\n"; + else + outs() << "Bitcode " << Filename << " does not contain ObjC\n"; + } + return 0; + } + if (ThinLTOMode.getNumOccurrences()) { if (ThinLTOMode.getNumOccurrences() > 1) report_fatal_error("You can't specify more than one -thinlto-action"); |

