Skip to content

Commit 76578ee

Browse files
committed
[cxx-interop] Minor refactoring: remove a redundant check
`cast<CustomAttr>` never returns nullptr, it either returns a non-null `CustomAttr*` or traps. This if condition was triggering a clang-tidy warning, since it is redundant.
1 parent 14f39be commit 76578ee

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5709,11 +5709,10 @@ void cloneImportedAttributes(ValueDecl *fromDecl, ValueDecl* toDecl) {
57095709
break;
57105710
}
57115711
case DeclAttrKind::Custom: {
5712-
if (CustomAttr *cAttr = cast<CustomAttr>(attr)) {
5713-
attrs.add(CustomAttr::create(context, SourceLoc(), cAttr->getTypeExpr(),
5714-
cAttr->getInitContext(), cAttr->getArgs(),
5715-
true));
5716-
}
5712+
CustomAttr *cAttr = cast<CustomAttr>(attr);
5713+
attrs.add(CustomAttr::create(context, SourceLoc(), cAttr->getTypeExpr(),
5714+
cAttr->getInitContext(), cAttr->getArgs(),
5715+
true));
57175716
break;
57185717
}
57195718
case DeclAttrKind::DiscardableResult: {

0 commit comments

Comments
 (0)