diff --git a/clang/include/clang/Driver/OffloadBundler.h b/clang/include/clang/Driver/OffloadBundler.h index fc96f200414d61..84349abe185fa4 100644 --- a/clang/include/clang/Driver/OffloadBundler.h +++ b/clang/include/clang/Driver/OffloadBundler.h @@ -56,13 +56,14 @@ class OffloadBundler { // TODO: Add error checking from ClangOffloadBundler.cpp OffloadBundler(const OffloadBundlerConfig &BC) : BundlerConfig(BC) {} + // List bundle IDs. Return true if an error was found. + static llvm::Error + ListBundleIDsInFile(llvm::StringRef InputFileName, + const OffloadBundlerConfig &BundlerConfig); + llvm::Error BundleFiles(); llvm::Error UnbundleFiles(); llvm::Error UnbundleArchive(); - - // List bundle IDs. Return true if an error was found. - static llvm::Error ListBundleIDsInFile(llvm::StringRef InputFileName, - const OffloadBundlerConfig &BundlerConfig); }; /// Obtain the offload kind, real machine triple, and an optional TargetID @@ -78,7 +79,8 @@ struct OffloadTargetInfo { const OffloadBundlerConfig &BundlerConfig; - OffloadTargetInfo(const llvm::StringRef Target, const OffloadBundlerConfig &BC); + OffloadTargetInfo(const llvm::StringRef Target, + const OffloadBundlerConfig &BC); bool hasHostKind() const; bool isOffloadKindValid() const; bool isOffloadKindCompatible(const llvm::StringRef TargetOffloadKind) const; diff --git a/clang/lib/Driver/OffloadBundler.cpp b/clang/lib/Driver/OffloadBundler.cpp index 262315c9ba3cca..b1091aca5616f8 100644 --- a/clang/lib/Driver/OffloadBundler.cpp +++ b/clang/lib/Driver/OffloadBundler.cpp @@ -132,14 +132,9 @@ bool OffloadTargetInfo::isTripleValid() const { bool OffloadTargetInfo::operator==(const OffloadTargetInfo &Target) const { return OffloadKind == Target.OffloadKind && - Triple.isCompatibleWith(Target.Triple) && - TargetID == Target.TargetID; + Triple.isCompatibleWith(Target.Triple) && TargetID == Target.TargetID; } -//std::string OffloadTargetInfo::str() { -// Triple.isCompatibleWith(Target.Triple) && TargetID == Target.TargetID; -//} - std::string OffloadTargetInfo::str() const { return Twine(OffloadKind + "-" + Triple.str() + "-" + TargetID).str(); } @@ -557,7 +552,8 @@ class ObjectFileHandler final : public FileHandler { public: // TODO: Add error checking from ClangOffloadBundler.cpp - ObjectFileHandler(std::unique_ptr ObjIn, const OffloadBundlerConfig &BC) + ObjectFileHandler(std::unique_ptr ObjIn, + const OffloadBundlerConfig &BC) : Obj(std::move(ObjIn)), CurrentSection(Obj->section_begin()), NextSection(Obj->section_begin()), BundlerConfig(BC) {} @@ -1574,7 +1570,8 @@ Error OffloadBundler::UnbundleArchive() { return FileHandlerOrErr.takeError(); std::unique_ptr &FileHandler = *FileHandlerOrErr; - assert(FileHandler); + assert(FileHandler && + "FileHandle creation failed for file in the archive!"); if (Error ReadErr = FileHandler->ReadHeader(CodeObjectBuffer)) return ReadErr; diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp index d922424bc274a8..ec67e24552e9c9 100644 --- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -274,8 +274,9 @@ int main(int argc, const char **argv) { "-targets option is invalid for -list")); } - doWork([&]() { return OffloadBundler::ListBundleIDsInFile(InputFileNames.front(), - BundlerConfig); }); + doWork([&]() { return OffloadBundler::ListBundleIDsInFile( + InputFileNames.front(), + BundlerConfig); }); return 0; }