summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2022-02-12 10:57:09 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2022-02-12 10:57:09 +0000
commited5d659038362d6ccfebad3d9b7e10e73e681196 (patch)
tree3cad92559896c8a910626e631c1bbeb0c1108d29
parent99acc0dc6434373dc391ac4c89f6ae6b72ec7208 (diff)
[clang-tidy] NoexceptMoveConstructorCheck::check - use castAs<> instead of getAs<> to avoid dereference of nullptr
The pointer is referenced immediately, so assert the cast is correct instead of returning nullptr
-rw-r--r--clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp b/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
index f87f214945fa..782498bd69e9 100644
--- a/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
@@ -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;