Skip to content

Commit 6ff6a86

Browse files
UD18 Coverity fix (#67)
1 parent a30fcda commit 6ff6a86

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

tools/npureg-tblgen/main.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#include <vpux/compiler/dialect/VPU/enums.cpp.inc>
2525
// clang-format on
2626

27-
#include "vpux/utils/core/format.hpp"
2827
#include "vpux/utils/core/error.hpp"
28+
#include "vpux/utils/core/format.hpp"
2929

3030
enum ActionType { Generate };
3131

@@ -348,14 +348,19 @@ llvm::Error generate(llvm::raw_ostream& stream, llvm::RecordKeeper& records, con
348348

349349
bool RegGenMain(llvm::raw_ostream& stream, llvm::RecordKeeper& records) {
350350
auto doGenerate = [](auto& stream, auto& records, auto& platformTypeName) {
351-
if (auto error = generate(stream, records, platformTypeName)) {
352-
handleAllErrors(std::move(error), [](const llvm::ErrorInfoBase& error) {
353-
error.log(llvm::WithColor::error());
354-
llvm::errs() << '\n';
355-
});
356-
return true;
351+
try {
352+
if (auto error = generate(stream, records, platformTypeName)) {
353+
handleAllErrors(std::move(error), [](const llvm::ErrorInfoBase& error) {
354+
error.log(llvm::WithColor::error());
355+
llvm::errs() << '\n';
356+
});
357+
return true;
358+
}
359+
return false;
360+
} catch (const vpux::Exception& e) {
361+
llvm::errs() << "vpux::Exception caught: " << e.what() << "\n";
362+
return false;
357363
}
358-
return false;
359364
};
360365

361366
const auto platformTypeName = platformTypeMap[vpux::VPU::stringifyArchKind(Platform).str()];

0 commit comments

Comments
 (0)