[clang-tidy] NoexceptMoveConstructorCheck::check - use castAs<> instead of getAs...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 12 Feb 2022 10:57:09 +0000 (10:57 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 12 Feb 2022 10:57:09 +0000 (10:57 +0000)
The pointer is referenced immediately, so assert the cast is correct instead of returning nullptr

clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp

index f87f214..782498b 100644 (file)
@@ -38,7 +38,7 @@ void NoexceptMoveConstructorCheck::check(
       return;
     }
 
-    const auto *ProtoType = Decl->getType()->getAs<FunctionProtoType>();
+    const auto *ProtoType = Decl->getType()->castAs<FunctionProtoType>();
 
     if (isUnresolvedExceptionSpec(ProtoType->getExceptionSpecType()))
       return;